From: Mike Karels Date: Fri, 18 Aug 1989 06:59:46 +0000 (-0800) Subject: need to init mask each time for select X-Git-Tag: BSD-4_3_Reno-Snapshot-Development~5769 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/1070431c69b2330d53169dc68f72c690c8611978 need to init mask each time for select SCCS-vsn: sbin/ping/ping.c 5.3 --- diff --git a/usr/src/sbin/ping/ping.c b/usr/src/sbin/ping/ping.c index b1cc1e2ce0..9cf1eeface 100644 --- a/usr/src/sbin/ping/ping.c +++ b/usr/src/sbin/ping/ping.c @@ -25,7 +25,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)ping.c 5.2 (Berkeley) %G%"; +static char sccsid[] = "@(#)ping.c 5.3 (Berkeley) %G%"; #endif /* not lint */ /* @@ -320,11 +320,7 @@ main(argc, argv) while (preload--) /* fire off them quickies */ pinger(); - if (options & F_FLOOD) { - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - fdmask = 1 << s; - } else + if ((options & F_FLOOD) == 0) catcher(); /* start things going */ for (;;) { @@ -334,8 +330,11 @@ main(argc, argv) if (options & F_FLOOD) { pinger(); - if (!select(32, (fd_set *)&fdmask, (fd_set *)NULL, - (fd_set *)NULL, &timeout)) + timeout.tv_sec = 0; + timeout.tv_usec = 10000; + fdmask = 1 << s; + if (select(s + 1, (fd_set *)&fdmask, (fd_set *)NULL, + (fd_set *)NULL, &timeout) < 1) continue; } fromlen = sizeof(from);