aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-05-31 23:54:50 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-05-31 23:54:50 +0000
commitf7f0aaeb516871b899c09394971fc75f631e00ef (patch)
tree0ad89abbb36b9fe9f72ce6536689617f9cfa3b60
parent0808a4e7386b151b0019caf1c88ad39a8581791e (diff)
downloadbusybox-w32-f7f0aaeb516871b899c09394971fc75f631e00ef.tar.gz
busybox-w32-f7f0aaeb516871b899c09394971fc75f631e00ef.tar.bz2
busybox-w32-f7f0aaeb516871b899c09394971fc75f631e00ef.zip
Bugfix from Shaun Jackman: don't attempt to write 64 bytes and then fail if
the write wasn't 192 bytes long. git-svn-id: svn://busybox.net/trunk/busybox@15256 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--networking/ping.c5
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)
110 c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0, 110 c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
111 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); 111 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
112 112
113 if (c < 0 || c != sizeof(packet)) 113 if (c < 0) {
114 if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
114 bb_perror_msg_and_die("sendto"); 115 bb_perror_msg_and_die("sendto");
116 }
115 117
116 signal(SIGALRM, noresp); 118 signal(SIGALRM, noresp);
117 alarm(5); /* give the host 5000ms to respond */ 119 alarm(5); /* give the host 5000ms to respond */
@@ -135,6 +137,7 @@ static void ping(const char *host)
135 break; 137 break;
136 } 138 }
137 } 139 }
140 if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
138 printf("%s is alive!\n", hostname); 141 printf("%s is alive!\n", hostname);
139 return; 142 return;
140} 143}