summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-09-05 00:29:21 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-09-05 00:29:21 +0000
commit7ead80499dcfa08bfe5c1e2f01a605a1eec9b156 (patch)
treea4cf6ee77fd13043b748e60e839859043364b2c3 /usr.bin
parent7995821039af4cc3cd76a2d253983b6b9d94d3c3 (diff)
select for a more accurate size; millert ok
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/talk/ctl_transact.c8
-rw-r--r--usr.bin/talk/io.c13
2 files changed, 13 insertions, 8 deletions
diff --git a/usr.bin/talk/ctl_transact.c b/usr.bin/talk/ctl_transact.c
index ccf9c8ab00a..dd3b2368392 100644
--- a/usr.bin/talk/ctl_transact.c
+++ b/usr.bin/talk/ctl_transact.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctl_transact.c,v 1.6 1999/03/03 20:43:30 millert Exp $ */
+/* $OpenBSD: ctl_transact.c,v 1.7 2001/09/05 00:29:20 deraadt Exp $ */
/* $NetBSD: ctl_transact.c,v 1.3 1994/12/09 02:14:12 jtc Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ctl_transact.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: ctl_transact.c,v 1.6 1999/03/03 20:43:30 millert Exp $";
+static char rcsid[] = "$OpenBSD: ctl_transact.c,v 1.7 2001/09/05 00:29:20 deraadt Exp $";
#endif /* not lint */
#include "talk.h"
@@ -89,7 +89,7 @@ ctl_transact(target, msg, type, rp)
quit("Error on write to talk daemon", 1);
}
read_mask = ctl_mask;
- nready = select(32, &read_mask, 0, 0, &wait);
+ nready = select(ctl_sockt + 1, &read_mask, 0, 0, &wait);
if (nready < 0) {
if (errno == EINTR)
continue;
@@ -111,7 +111,7 @@ ctl_transact(target, msg, type, rp)
read_mask = ctl_mask;
/* an immediate poll */
timerclear(&wait);
- nready = select(32, &read_mask, 0, 0, &wait);
+ nready = select(ctl_sockt + 1, &read_mask, 0, 0, &wait);
} while (nready > 0 && (rp->vers != TALK_VERSION ||
rp->type != type));
} while (rp->vers != TALK_VERSION || rp->type != type);
diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c
index c4fd13c0397..40a3d730799 100644
--- a/usr.bin/talk/io.c
+++ b/usr.bin/talk/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.9 1999/03/03 20:43:30 millert Exp $ */
+/* $OpenBSD: io.c,v 1.10 2001/09/05 00:29:20 deraadt Exp $ */
/* $NetBSD: io.c,v 1.4 1994/12/09 02:14:20 jtc Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: io.c,v 1.9 1999/03/03 20:43:30 millert Exp $";
+static char rcsid[] = "$OpenBSD: io.c,v 1.10 2001/09/05 00:29:20 deraadt Exp $";
#endif /* not lint */
/*
@@ -66,6 +66,7 @@ talk()
int nb;
char buf[BUFSIZ];
struct timeval wait;
+ int maxfd = 0;
#if defined(NCURSES_VERSION) || defined(beep)
message("Connection established");
@@ -82,13 +83,17 @@ talk()
* standard input ( STDIN_MASK )
*/
FD_ZERO(&read_template);
- FD_SET(sockt, &read_template);
FD_SET(fileno(stdin), &read_template);
+ if (fileno(stdin) > maxfd)
+ maxfd = fileno(stdin);
+ FD_SET(sockt, &read_template);
+ if (sockt > maxfd)
+ maxfd = sockt;
for (;;) {
read_set = read_template;
wait.tv_sec = A_LONG_TIME;
wait.tv_usec = 0;
- nb = select(32, &read_set, 0, 0, &wait);
+ nb = select(maxfd + 1, &read_set, 0, 0, &wait);
if (nb <= 0) {
if (errno == EINTR) {
read_set = read_template;