summaryrefslogtreecommitdiff
path: root/sbin/ping
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-23 08:36:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-23 08:36:45 +0000
commit756ce2f0953ebbdd452295be27cb68e354b2f9c3 (patch)
treed26edff3d79e8412c9f262cbf0e54754b070c17c /sbin/ping
parent60a7cd45adbd31ba78d5edf9aa2d43ba092ed75f (diff)
skip until ptrace problem is resolved
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index e273b633881..49c0a225354 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.5 1996/07/23 02:30:22 deraadt Exp $ */
+/* $OpenBSD: ping.c,v 1.6 1996/07/23 08:36:44 deraadt Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: ping.c,v 1.5 1996/07/23 02:30:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ping.c,v 1.6 1996/07/23 08:36:44 deraadt Exp $";
#endif
#endif /* not lint */
@@ -182,7 +182,7 @@ main(argc, argv)
struct protoent *proto;
struct in_addr saddr;
register int i;
- int ch, fdmask, hold = 1, packlen, preload;
+ int ch, fdmask, hold, packlen, preload;
u_char *datap, *packet;
char *target, hnamebuf[MAXHOSTNAMELEN];
u_char ttl = MAXTTL, loop = 1, df = 0;
@@ -191,14 +191,6 @@ main(argc, argv)
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
#endif
- if (!(proto = getprotobyname("icmp")))
- errx(1, "unknown protocol icmp");
- if ((s = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0)
- err(1, "socket");
-
- /* revoke privs */
- setuid(getuid());
-
preload = 0;
datap = &outpack[8 + sizeof(struct timeval)];
while ((ch = getopt(argc, argv, "DI:LRS:c:dfh:i:l:np:qrs:T:t:vw:")) != EOF)
@@ -332,6 +324,12 @@ main(argc, argv)
ident = getpid() & 0xFFFF;
+ if (!(proto = getprotobyname("icmp")))
+ errx(1, "unknown protocol icmp");
+ if ((s = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0)
+ err(1, "socket");
+ hold = 1;
+
if (options & F_SADDR) {
if (IN_MULTICAST(ntohl(to->sin_addr.s_addr)))
moptions |= MULTICAST_IF;