diff options
Diffstat (limited to 'ping.c')
-rw-r--r-- | ping.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ping.c,v 1.6 1999/12/11 08:41:28 andersen Exp $ | 2 | * $Id: ping.c,v 1.7 2000/01/26 20:06:48 erik Exp $ |
3 | * Mini ping implementation for busybox | 3 | * Mini ping implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -319,10 +319,11 @@ static void ping(char *host) | |||
319 | int sockopt; | 319 | int sockopt; |
320 | 320 | ||
321 | if (!(proto = getprotobyname("icmp"))) { | 321 | if (!(proto = getprotobyname("icmp"))) { |
322 | fprintf(stderr, "ping: unknown protocol icmp\n"); | 322 | /* getprotobyname failed, so just silently force |
323 | exit(1); | 323 | * proto->p_proto to have the correct value for "icmp" */ |
324 | proto->p_proto = 1; | ||
324 | } | 325 | } |
325 | if ((pingsock = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0) { | 326 | if ((pingsock = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0) { /* 1 == ICMP */ |
326 | if (errno == EPERM) { | 327 | if (errno == EPERM) { |
327 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); | 328 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); |
328 | } else { | 329 | } else { |