aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.83
-rw-r--r--sbin/ping/ping.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8
index 11199b574f42..8478cb946414 100644
--- a/sbin/ping/ping.8
+++ b/sbin/ping/ping.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
-.\" $Id: ping.8,v 1.8 1997/03/01 20:19:18 wollman Exp $
+.\" $Id: ping.8,v 1.9 1997/03/02 06:32:42 imp Exp $
.\"
.Dd March 1, 1997
.Dt PING 8
@@ -120,6 +120,7 @@ is specified,
.Nm ping
sends that many packets as fast as possible before falling into its normal
mode of behavior.
+Only the super-user may use this option.
.It Fl L
Suppress loopback of multicast packets.
This flag only applies if the ping destination is a multicast address.
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index afb34abcb8d2..491cf2eb7afd 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);