summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-10-07 16:05:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-10-07 16:05:46 +0000
commitcab731516adf915807ad26720e7580c306554624 (patch)
tree19c798a2b90e54fc67cccc7645729f9d33a61a08 /usr.sbin
parent4dacf33c2423c92e50d2a17a1f07c8823833b6e6 (diff)
use poll to avoid fd_set overflow
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/traceroute6/traceroute6.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index 242f30e8f96..3d58c72b4e8 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute6.c,v 1.11 2000/06/30 16:00:29 millert Exp $ */
+/* $OpenBSD: traceroute6.c,v 1.12 2000/10/07 16:05:45 deraadt Exp $ */
/* $KAME: traceroute6.c,v 1.29 2000/06/12 16:29:18 itojun Exp $ */
/*
@@ -261,6 +261,7 @@ static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";
#include <netdb.h>
#include <stdio.h>
#include <err.h>
+#include <poll.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -866,15 +867,14 @@ wait_for_reply(sock, mhdr)
int sock;
struct msghdr *mhdr;
{
- fd_set fds;
- struct timeval wait;
+ struct pollfd pfd[1];
int cc = 0;
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
- wait.tv_sec = waittime; wait.tv_usec = 0;
+ pfd[0].fd = sock;
+ pfd[0].events = POLLIN;
+ pfd[0].revents = 0;
- if (select(sock+1, &fds, (fd_set *)0, (fd_set *)0, &wait) > 0)
+ if (poll(pfd, 1, waittime * 1000) > 0)
cc = recvmsg(rcvsock, mhdr, 0);
return(cc);