-/* $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.
#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>
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));
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));