diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-03-26 19:42:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-03-26 19:42:00 +0000 |
commit | 62c280912c41c7a2746ba2b400dc0203f3f4e86e (patch) | |
tree | bf2feef5d7468fce140e31c97c48063a733c720f | |
parent | 751263a67df4a75d61e175e5580e8f1aeee1829a (diff) |
calculate width for select() more carefully
-rw-r--r-- | usr.bin/rsh/rsh.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c index b708793dbe6..4b0cf83b3a6 100644 --- a/usr.bin/rsh/rsh.c +++ b/usr.bin/rsh/rsh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsh.c,v 1.11 1997/01/15 23:43:09 millert Exp $ */ +/* $OpenBSD: rsh.c,v 1.12 1997/03/26 19:41:59 deraadt Exp $ */ /*- * Copyright (c) 1983, 1990 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rsh.c 5.24 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$OpenBSD: rsh.c,v 1.11 1997/01/15 23:43:09 millert Exp $"; +static char rcsid[] = "$OpenBSD: rsh.c,v 1.12 1997/03/26 19:41:59 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -328,7 +328,7 @@ reread: errno = 0; bp = buf; rewrite: rembits = 1 << rem; - if (select(16, 0, &rembits, 0, 0) < 0) { + if (select(rem + 1, 0, &rembits, 0, 0) < 0) { if (errno != EINTR) { (void)fprintf(stderr, "rsh: select: %s.\n", strerror(errno)); @@ -363,7 +363,7 @@ done: readfrom = (1 << rfd2) | (1 << rem); do { ready = readfrom; - if (select(16, &ready, 0, 0, 0) < 0) { + if (select(MAX(rfd2, rem) + 1, &ready, 0, 0, 0) < 0) { if (errno != EINTR) { (void)fprintf(stderr, "rsh: select: %s.\n", strerror(errno)); |