summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-02-15 03:12:08 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-02-15 03:12:08 +0000
commitf9452513fcf92be881809006ce3c210805d5f2ad (patch)
tree7422ff5a747a6183001292786a74b36adc9453b4
parentd8a9021f3652d8ab99d0fed2460420c3eb4e10a2 (diff)
- deraadt@cvs.openbsd.org 2001/02/12 22:56:09
[clientloop.c packet.c ssh-keyscan.c] deal with EAGAIN/EINTR selects which were skipped
-rw-r--r--ChangeLog5
-rw-r--r--clientloop.c11
-rw-r--r--packet.c11
-rw-r--r--ssh-keyscan.c7
4 files changed, 27 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 14424b68..6ffe5170 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,9 @@
ssh-keygen.c sshd.8]
PermitRootLogin={yes,without-password,forced-commands-only,no}
(before this change, root could login even if PermitRootLogin==no)
+ - deraadt@cvs.openbsd.org 2001/02/12 22:56:09
+ [clientloop.c packet.c ssh-keyscan.c]
+ deal with EAGAIN/EINTR selects which were skipped
20010214
- (djm) Don't try to close PAM session or delete credentials if the
@@ -3948,4 +3951,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.764 2001/02/15 03:08:27 mouring Exp $
+$Id: ChangeLog,v 1.765 2001/02/15 03:12:08 mouring Exp $
diff --git a/clientloop.c b/clientloop.c
index e892c1ab..547ccabf 100644
--- a/clientloop.c
+++ b/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.51 2001/02/13 21:51:09 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -406,6 +406,15 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
if (select((*maxfdp)+1, *readsetp, *writesetp, NULL, NULL) < 0) {
char buf[100];
+
+ /*
+ * We have to clear the select masks, because we return.
+ * We have to return, because the mainloop checks for the flags
+ * set by the signal handlers.
+ */
+ memset(*readsetp, 0, *maxfdp);
+ memset(*writesetp, 0, *maxfdp);
+
if (errno == EINTR)
return;
/* Note: we might still have data in the buffers. */
diff --git a/packet.c b/packet.c
index 46e89bc0..fb431455 100644
--- a/packet.c
+++ b/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/ssh-keyscan.c b/ssh-keyscan.c
index 834649fe..5cd368e9 100644
--- a/ssh-keyscan.c
+++ b/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 $");
#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
#include <sys/queue.h>
@@ -498,7 +498,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);