diff options
author | Rob Landley <rob@landley.net> | 2006-05-31 23:54:50 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-05-31 23:54:50 +0000 |
commit | 9b1857f79ffcbbef1b478532422d96c619028a08 (patch) | |
tree | 0ad89abbb36b9fe9f72ce6536689617f9cfa3b60 /networking | |
parent | d5b9b60fa543b9910f8cd035e3d0a9a511ef6892 (diff) | |
download | busybox-9b1857f79ffcbbef1b478532422d96c619028a08.tar.gz |
Bugfix from Shaun Jackman: don't attempt to write 64 bytes and then fail if
the write wasn't 192 bytes long.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ping.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/networking/ping.c b/networking/ping.c index d9d76bf34..518265668 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -110,8 +110,10 @@ static void ping(const char *host) c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0, (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); - if (c < 0 || c != sizeof(packet)) + if (c < 0) { + if (ENABLE_FEATURE_CLEAN_UP) close(pingsock); bb_perror_msg_and_die("sendto"); + } signal(SIGALRM, noresp); alarm(5); /* give the host 5000ms to respond */ @@ -135,6 +137,7 @@ static void ping(const char *host) break; } } + if (ENABLE_FEATURE_CLEAN_UP) close(pingsock); printf("%s is alive!\n", hostname); return; } |