diff options
author | Jim Rees <rees@cvs.openbsd.org> | 2001-07-16 22:01:23 +0000 |
---|---|---|
committer | Jim Rees <rees@cvs.openbsd.org> | 2001-07-16 22:01:23 +0000 |
commit | 217678283d073a57ec407cace389b4e29f2c51f3 (patch) | |
tree | d9e38de4034cb302ad854e0aec7561bdb765cd18 /lib/libsectok | |
parent | 1defaba8181da172c09956573344866905b6214b (diff) |
alpha and fdset fixes from millert
Diffstat (limited to 'lib/libsectok')
-rw-r--r-- | lib/libsectok/scio.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libsectok/scio.c b/lib/libsectok/scio.c index 0234be28dff..2c1265bf00e 100644 --- a/lib/libsectok/scio.c +++ b/lib/libsectok/scio.c @@ -1,4 +1,4 @@ -/* $Id: scio.c,v 1.5 2001/07/02 20:07:09 rees Exp $ */ +/* $Id: scio.c,v 1.6 2001/07/16 22:01:22 rees Exp $ */ /* copyright 1997 @@ -46,6 +46,7 @@ such damages. #include <unistd.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <termios.h> #include <signal.h> #include <fcntl.h> @@ -374,15 +375,17 @@ int scgetc(int ttyn, unsigned char *cp, int ms) { int fd = sc[ttyn].fd; - fd_set fdset; + fd_set *fdset; struct timeval tv, *tvp; #ifdef BYTECOUNT num_getc++; #endif /* BYTECOUNT */ - FD_ZERO(&fdset); - FD_SET(fd, &fdset); + fdset = (fd_set *)calloc(howmany(fd + 1, NFDBITS), sizeof(fd_mask)); + if (fdset == NULL) + return SCENOMEM; + FD_SET(fd, fdset); if (ms == -1) tvp = NULL; @@ -392,7 +395,7 @@ scgetc(int ttyn, unsigned char *cp, int ms) tvp = &tv; } - if (select(fd + 1, &fdset, NULL, NULL, tvp) != 1) + if (select(fd + 1, fdset, NULL, NULL, tvp) != 1) return SCTIMEO; if (read(fd, cp, 1) != 1) |