diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2022-12-11 23:44:08 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-12-12 16:14:11 +0000 |
commit | 37506878219b13160a64b87dfbb4aac8d3063fa1 (patch) | |
tree | 2ba381cd3ab0415b3fdc5fd3873fb9b39b356d90 /Userland | |
parent | 5532640b7178195060422934b8e10b128ab9a8de (diff) | |
download | serenity-37506878219b13160a64b87dfbb4aac8d3063fa1.zip |
LibCore: Use `Core::System::poll()` in `PosixSocketHelper`
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibCore/Stream.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp index 96216e2c07..bae56c00c5 100644 --- a/Userland/Libraries/LibCore/Stream.cpp +++ b/Userland/Libraries/LibCore/Stream.cpp @@ -9,7 +9,6 @@ #include <LibCore/System.h> #include <fcntl.h> #include <netdb.h> -#include <poll.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/types.h> @@ -461,15 +460,13 @@ ErrorOr<bool> PosixSocketHelper::can_read_without_blocking(int timeout) const { struct pollfd the_fd = { .fd = m_fd, .events = POLLIN, .revents = 0 }; - // FIXME: Convert this to Core::System - int rc; + ErrorOr<int> result { 0 }; do { - rc = ::poll(&the_fd, 1, timeout); - } while (rc < 0 && errno == EINTR); + result = Core::System::poll({ &the_fd, 1 }, timeout); + } while (result.is_error() && result.error().code() == EINTR); - if (rc < 0) { - return Error::from_syscall("poll"sv, -errno); - } + if (result.is_error()) + return result.release_error(); return (the_fd.revents & POLLIN) > 0; } |