From c462ca854a9e48f9c945725d54d8ae6eded28355 Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 26 Mar 1997 19:41:59 +0000 Subject: [PATCH] calculate width for select() more carefully --- usr.bin/rsh/rsh.c | 8 ++++---- 1 file 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 @@ -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)); -- 2.20.1