From 4e9ef48afa0904f9d7d15a4061c0b5ccf2721e20 Mon Sep 17 00:00:00 2001 From: mckay Date: Fri, 7 May 1999 14:38:48 +0000 Subject: Make flood ping flood again. It hasn't worked since 2.2.6. Make the "-l" option work as described in the manual, not as another flood ping variant. Once discussed to death with: bde --- sbin/ping/ping.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sbin') diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 6e41241..f1a563e 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; #endif static const char rcsid[] = - "$Id: ping.c,v 1.42 1999/01/06 07:54:28 imp Exp $"; + "$Id: ping.c,v 1.43 1999/04/25 22:33:30 imp Exp $"; #endif /* not lint */ /* @@ -274,11 +274,10 @@ main(argc, argv) if (*ep || ep == optarg || ultmp > INT_MAX) errx(EX_USAGE, "invalid preload value: `%s'", optarg); - if (getuid()) { + if (uid) { errno = EPERM; err(EX_NOPERM, "-l flag"); } - options |= F_FLOOD; preload = ultmp; break; case 'L': @@ -554,6 +553,8 @@ main(argc, argv) if (timeout.tv_sec < 0) timeout.tv_sec = timeout.tv_usec = 0; n = select(s + 1, &rfds, NULL, NULL, &timeout); + if (n < 0) + continue; /* Must be EINTR. */ if (n == 1) { struct timeval *t = 0; #ifdef SO_TIMESTAMP @@ -585,13 +586,14 @@ main(argc, argv) if (npackets && nreceived >= npackets) break; } - if (n == 0) { + if (n == 0 || options & F_FLOOD) { if (!npackets || ntransmitted < npackets) pinger(); else { if (almost_done) break; almost_done = 1; + intvl.tv_usec = 0; if (nreceived) { intvl.tv_sec = 2 * tmax / 1000; if (!intvl.tv_sec) -- cgit v1.1