summaryrefslogtreecommitdiff
path: root/ping.c
diff options
context:
space:
mode:
authorErik Andersen2000-01-26 20:06:48 +0000
committerErik Andersen2000-01-26 20:06:48 +0000
commit5cbdd712f5320ffc109053a94b7cf36c82292cf6 (patch)
tree77236e83cc0583411a75b752a6152d445eb680e0 /ping.c
parent3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea (diff)
downloadbusybox-5cbdd712f5320ffc109053a94b7cf36c82292cf6.zip
busybox-5cbdd712f5320ffc109053a94b7cf36c82292cf6.tar.gz
mount and umount could leak loop device allocations causing the system to
quickly run out. Also disable init's SIGHUP handler during shutdown. -Erik
Diffstat (limited to 'ping.c')
-rw-r--r--ping.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ping.c b/ping.c
index 92b62de..2b6e7f5 100644
--- a/ping.c
+++ b/ping.c
@@ -1,5 +1,5 @@
/*
- * $Id: ping.c,v 1.6 1999/12/11 08:41:28 andersen Exp $
+ * $Id: ping.c,v 1.7 2000/01/26 20:06:48 erik Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -319,10 +319,11 @@ static void ping(char *host)
int sockopt;
if (!(proto = getprotobyname("icmp"))) {
- fprintf(stderr, "ping: unknown protocol icmp\n");
- exit(1);
+ /* getprotobyname failed, so just silently force
+ * proto->p_proto to have the correct value for "icmp" */
+ proto->p_proto = 1;
}
- if ((pingsock = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0) {
+ if ((pingsock = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0) { /* 1 == ICMP */
if (errno == EPERM) {
fprintf(stderr, "ping: permission denied. (are you root?)\n");
} else {