diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-02-12 22:56:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-02-12 22:56:11 +0000 |
commit | 545fb7fdc78d7e162bd026b8981daefb41d3682a (patch) | |
tree | 22ad187cb5900e76a27fc663f12d0c1dd3a175b3 | |
parent | 039f1b028e913449bc2e3498cb30d6f0025ff71c (diff) |
deal with EAGAIN/EINTR selects which were skipped
-rw-r--r-- | usr.bin/ssh/clientloop.c | 3 | ||||
-rw-r--r-- | usr.bin/ssh/packet.c | 11 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-keyscan.c | 7 |
3 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index e892c1abd77..b77e8446b88 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -59,7 +59,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: clientloop.c,v 1.49 2001/02/08 19:30:51 itojun Exp $"); +RCSID("$OpenBSD: clientloop.c,v 1.50 2001/02/12 22:56:08 deraadt Exp $"); #include "ssh.h" #include "ssh1.h" @@ -406,6 +406,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, if (select((*maxfdp)+1, *readsetp, *writesetp, NULL, NULL) < 0) { char buf[100]; + if (errno == EINTR) return; /* Note: we might still have data in the buffers. */ diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c index 5b42e8d603a..0ede9452222 100644 --- a/usr.bin/ssh/packet.c +++ b/usr.bin/ssh/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.50 2001/02/11 12:59:25 markus Exp $"); +RCSID("$OpenBSD: packet.c,v 1.51 2001/02/12 22:56:09 deraadt Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -688,7 +688,9 @@ packet_read(int *payload_len_ptr) FD_SET(connection_in, &set); /* Wait for some data to arrive. */ - select(connection_in + 1, &set, NULL, NULL, NULL); + while (select(connection_in + 1, &set, NULL, NULL, NULL) == -1 && + (errno == EAGAIN || errno == EINTR)) + ; /* Read data from the socket. */ len = read(connection_in, buf, sizeof(buf)); @@ -1195,9 +1197,12 @@ packet_write_wait() packet_write_poll(); while (packet_have_data_to_write()) { fd_set set; + FD_ZERO(&set); FD_SET(connection_out, &set); - select(connection_out + 1, NULL, &set, NULL, NULL); + while (select(connection_out + 1, NULL, &set, NULL, NULL) == -1 && + (errno == EAGAIN || errno == EINTR)) + ; packet_write_poll(); } } diff --git a/usr.bin/ssh/ssh-keyscan.c b/usr.bin/ssh/ssh-keyscan.c index 78dd344f458..8c6316a7fc2 100644 --- a/usr.bin/ssh/ssh-keyscan.c +++ b/usr.bin/ssh/ssh-keyscan.c @@ -8,7 +8,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-keyscan.c,v 1.15 2001/02/09 09:04:59 itojun Exp $"); +RCSID("$OpenBSD: ssh-keyscan.c,v 1.16 2001/02/12 22:56:10 deraadt Exp $"); #include <sys/queue.h> #include <errno.h> @@ -478,7 +478,10 @@ conloop(void) seltime.tv_sec = seltime.tv_usec = 0; r = e = read_wait; - select(maxfd, &r, NULL, &e, &seltime); + while (select(maxfd, &r, NULL, &e, &seltime) == -1 && + (errno == EAGAIN || errno == EINTR)) + ; + for (i = 0; i < maxfd; i++) if (FD_ISSET(i, &e)) { error("%s: exception!", fdcon[i].c_name); |