From 89622c2d59f7d2f1f12d7fd548d570313942945d Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 1 Dec 2001 18:54:44 +0000 Subject: fix fd_set overflow --- libexec/identd/parse.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libexec/identd') diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c index bbb714ad9d4..9a17e151169 100644 --- a/libexec/identd/parse.c +++ b/libexec/identd/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.26 2001/08/08 07:02:42 deraadt Exp $ */ +/* $OpenBSD: parse.c,v 1.27 2001/12/01 18:54:43 deraadt Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -174,16 +174,18 @@ timed_write(fd, buf, siz, timeout) time_t timeout; { int error; - fd_set writeds; + struct pollfd wfd[2]; struct timeval tv; - FD_ZERO(&writeds); - FD_SET(fd, &writeds); + wfd[0].fd = fd; + wfd[0].events = POLLOUT; + wfd[0].revents = 0; tv.tv_sec = timeout; tv.tv_usec = 0; - if ((error = select(fd + 1, 0, &writeds, 0, &tv)) <= 0) + if ((error = poll(wfd, 1, tv.tv_sec * 1000 + + tv.tv_usec / 1000)) <= 0) return error; return(write(fd, buf, siz)); } -- cgit v1.2.3