summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-12-01 18:54:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-12-01 18:54:44 +0000
commit89622c2d59f7d2f1f12d7fd548d570313942945d (patch)
tree157ac18bc9bdb5c0d12ed68f1a9fe3b52be2e3e3 /libexec
parent3c07b1b5f18654a650967ac1742ead2ed1df126a (diff)
fix fd_set overflow
Diffstat (limited to 'libexec')
-rw-r--r--libexec/identd/parse.c12
1 files changed, 7 insertions, 5 deletions
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));
}