diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2023-05-12 20:48:31 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2023-05-13 16:42:04 +0100 |
| commit | 94f98400bf950aa9835ff9b04c724f2aa3ebd0fc (patch) | |
| tree | 0dccc76a32683ac34918c8371bcb29f3b489e9bf /src/libgit2/streams | |
| parent | fad90428970e332153027773b517a1606c0efa1f (diff) | |
| download | libgit2-94f98400bf950aa9835ff9b04c724f2aa3ebd0fc.tar.gz | |
posix: introduce p_poll emulation with select
Not all systems have poll(2); emulate it with select(2).
Diffstat (limited to 'src/libgit2/streams')
| -rw-r--r-- | src/libgit2/streams/socket.c | 9 |
1 files changed, 4 insertions, 5 deletions
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 <netdb.h> # include <netinet/in.h> # include <arpa/inet.h> -# include <poll.h> #else # include <winsock2.h> # include <ws2tcpip.h> @@ -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); |
