diff options
author | imp <imp@FreeBSD.org> | 1997-03-02 20:01:13 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-03-02 20:01:13 +0000 |
commit | 914ff23b933ff3101973d357c711aa9218590447 (patch) | |
tree | 0c8f9689333ceeb6a7ff16543fde354f6f3dcba2 /sbin/ping/ping.c | |
parent | 4bd9c1366cf389c6e4ded500fc9386b551a14831 (diff) | |
download | FreeBSD-src-914ff23b933ff3101973d357c711aa9218590447.zip FreeBSD-src-914ff23b933ff3101973d357c711aa9218590447.tar.gz |
1) Minor nits in the usage message from bde. I took out the hard tabs and
used spaces to align the second line under the program name.
2) Cache uid after call to setuid(getuid()) so we don't waste a system call
for each packet with a call to getuid for the -v case.
3) Update manual to reflect new restriction on -l from last delta.
Suggested by: bde, Bill Fenner
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r-- | sbin/ping/ping.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index afb34abc..491cf2e 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"; */ static const char rcsid[] = - "$Id: ping.c,v 1.17 1997/03/01 20:19:18 wollman Exp $"; + "$Id: ping.c,v 1.18 1997/03/02 06:32:40 imp Exp $"; #endif /* not lint */ /* @@ -138,6 +138,7 @@ char BSPACE = '\b'; /* characters written for flood */ char DOT = '.'; char *hostname; int ident; /* process id to identify our packets */ +int uid; /* cached uid for micro-optimization */ /* counters */ long npackets; /* max packets to transmit */ @@ -201,6 +202,7 @@ main(argc, argv) sockerrno = errno; setuid(getuid()); + uid = getuid(); preload = 0; @@ -671,7 +673,7 @@ pr_pack(buf, cc, from) #endif struct icmp *oicmp = (struct icmp *)(oip + 1); - if (((options & F_VERBOSE) && getuid() == 0) || + if (((options & F_VERBOSE) && uid == 0) || (!(options & F_QUIET2) && (oip->ip_dst.s_addr == ((struct sockaddr_in *)&whereto)->sin_addr.s_addr) && @@ -1171,7 +1173,7 @@ usage(argv0) argv0 = strrchr(argv0,'/') + 1; fprintf(stderr, "usage: %s [-QRadfnqrv] [-c count] [-i wait] [-l preload] " - "[-p pattern]\n\t\t[-s packetsize] " + "[-p pattern]\n [-s packetsize] " "[host | [-L] [-I iface] [-T ttl] mcast-group]\n", argv0); exit(EX_USAGE); |