diff options
Diffstat (limited to 'usr.sbin/traceroute6/traceroute6.c')
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 3d58c72b4e8..d8bd23cba9c 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1,5 +1,5 @@ -/* $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 $ */ +/* $OpenBSD: traceroute6.c,v 1.13 2000/10/07 21:47:31 itojun Exp $ */ +/* $KAME: traceroute6.c,v 1.33 2000/10/07 06:22:55 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -261,7 +261,9 @@ static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93"; #include <netdb.h> #include <stdio.h> #include <err.h> +#ifdef HAVE_POLL #include <poll.h> +#endif #include <errno.h> #include <stdlib.h> #include <string.h> @@ -867,6 +869,7 @@ wait_for_reply(sock, mhdr) int sock; struct msghdr *mhdr; { +#ifdef HAVE_POLL struct pollfd pfd[1]; int cc = 0; @@ -878,6 +881,24 @@ wait_for_reply(sock, mhdr) cc = recvmsg(rcvsock, mhdr, 0); return(cc); +#else + fd_set *fdsp; + struct timeval wait; + int cc = 0, fdsn; + + fdsn = howmany(sock+1, NFDBITS) * sizeof(fd_mask); + if ((fdsp = (fd_set *)malloc(fdsn)) == NULL) + err(1, "malloc"); + memset(fdsp, 0, fdsn); + FD_SET(sock, fdsp); + wait.tv_sec = waittime; wait.tv_usec = 0; + + if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0) + cc = recvmsg(rcvsock, mhdr, 0); + + free(fdsp); + return(cc); +#endif } #ifdef IPSEC |