diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-07-12 20:26:32 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-07-12 20:26:32 +0000 |
commit | 7467c8d3b6a50e2cbd8db750963d40b420ad38d1 (patch) | |
tree | 10dcece1e0bb88e35aa95c3a68896ad426e43f7a /ping.c | |
parent | f69bfc76fa7acb0c87fa3f3b319fde361a8315a8 (diff) |
Patch from vodz:
Changed email address
cmdedit API change
optimizations for traceroute and md5sum
added a new shared create_icmp_socket() function
Diffstat (limited to 'ping.c')
-rw-r--r-- | ping.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.43 2001/05/21 20:30:51 andersen Exp $ + * $Id: ping.c,v 1.44 2001/07/12 20:26:31 andersen Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -191,11 +191,7 @@ static void ping(const char *host) int pingsock, c; char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; - if ((pingsock = socket(AF_INET, SOCK_RAW, 1)) < 0) /* 1 == ICMP */ - perror_msg_and_die("creating a raw socket"); - - /* drop root privs if running setuid */ - setuid(getuid()); + pingsock = create_raw_socket(); memset(&pingaddr, 0, sizeof(struct sockaddr_in)); @@ -434,7 +430,7 @@ static void ping(const char *host) if (errno == EPERM) error_msg_and_die("permission denied. (are you root?)"); else - perror_msg_and_die("creating a raw socket"); + perror_msg_and_die(can_not_create_raw_socket); } /* drop root privs if running setuid */ |