From 94f98400bf950aa9835ff9b04c724f2aa3ebd0fc Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Fri, 12 May 2023 20:48:31 +0100 Subject: posix: introduce p_poll emulation with select Not all systems have poll(2); emulate it with select(2). --- src/libgit2/streams/socket.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/libgit2') diff --git a/src/libgit2/streams/socket.c b/src/libgit2/streams/socket.c index 0e0aa6934..ecbdf7b7d 100644 --- a/src/libgit2/streams/socket.c +++ b/src/libgit2/streams/socket.c @@ -20,7 +20,6 @@ # include # include # include -# include #else # include # include @@ -135,13 +134,13 @@ static int connect_with_timeout( fd.events = POLLOUT; fd.revents = 0; - error = poll(&fd, 1, timeout); + error = p_poll(&fd, 1, timeout); if (error == 0) { return GIT_TIMEOUT; } else if (error != 1) { return -1; - } else if ((fd.revents & (POLLHUP | POLLERR))) { + } else if ((fd.revents & (POLLPRI | POLLHUP | POLLERR))) { return handle_sockerr(socket); } else if ((fd.revents & POLLOUT) != POLLOUT) { git_error_set(GIT_ERROR_NET, @@ -236,7 +235,7 @@ static ssize_t socket_write( fd.events = POLLOUT; fd.revents = 0; - ret = poll(&fd, 1, st->parent.timeout); + ret = p_poll(&fd, 1, st->parent.timeout); if (ret == 1) { ret = p_send(st->s, data, len, 0); @@ -272,7 +271,7 @@ static ssize_t socket_read( fd.events = POLLIN; fd.revents = 0; - ret = poll(&fd, 1, st->parent.timeout); + ret = p_poll(&fd, 1, st->parent.timeout); if (ret == 1) { ret = p_recv(st->s, data, len, 0); -- cgit v1.2.1