diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-02-09 07:01:33 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-02-09 07:01:33 +0000 |
commit | a837e2d9b3fe77f8cbddb7c5c50987822b9dc44b (patch) | |
tree | e78a691a3b211a18ef338631d9c962fd65843994 | |
parent | 06e9565b6c365668dafeef1fdc0e60c9a1154623 (diff) | |
download | busybox-w32-a837e2d9b3fe77f8cbddb7c5c50987822b9dc44b.tar.gz busybox-w32-a837e2d9b3fe77f8cbddb7c5c50987822b9dc44b.tar.bz2 busybox-w32-a837e2d9b3fe77f8cbddb7c5c50987822b9dc44b.zip |
Minor update to arping, patch from Nick Fedchik
-rw-r--r-- | networking/arping.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/networking/arping.c b/networking/arping.c index af44f9267..bf0a77cf4 100644 --- a/networking/arping.c +++ b/networking/arping.c | |||
@@ -336,7 +336,7 @@ int arping_main(int argc, char **argv) | |||
336 | exit(socket_errno); | 336 | exit(socket_errno); |
337 | } | 337 | } |
338 | 338 | ||
339 | if (1) { | 339 | { |
340 | struct ifreq ifr; | 340 | struct ifreq ifr; |
341 | 341 | ||
342 | memset(&ifr, 0, sizeof(ifr)); | 342 | memset(&ifr, 0, sizeof(ifr)); |
@@ -361,7 +361,7 @@ int arping_main(int argc, char **argv) | |||
361 | } | 361 | } |
362 | } | 362 | } |
363 | 363 | ||
364 | if (inet_aton(target, &dst) != 1) { | 364 | if (!inet_aton(target, &dst)) { |
365 | struct hostent *hp; | 365 | struct hostent *hp; |
366 | 366 | ||
367 | hp = gethostbyname2(target, AF_INET); | 367 | hp = gethostbyname2(target, AF_INET); |
@@ -372,7 +372,7 @@ int arping_main(int argc, char **argv) | |||
372 | memcpy(&dst, hp->h_addr, 4); | 372 | memcpy(&dst, hp->h_addr, 4); |
373 | } | 373 | } |
374 | 374 | ||
375 | if (source && inet_aton(source, &src) != 1) { | 375 | if (source && !inet_aton(source, &src)) { |
376 | error_msg("invalid source address %s", source); | 376 | error_msg("invalid source address %s", source); |
377 | exit(2); | 377 | exit(2); |
378 | } | 378 | } |
@@ -436,7 +436,7 @@ int arping_main(int argc, char **argv) | |||
436 | exit(2); | 436 | exit(2); |
437 | } | 437 | } |
438 | 438 | ||
439 | if (1) { | 439 | { |
440 | int alen = sizeof(me); | 440 | int alen = sizeof(me); |
441 | 441 | ||
442 | if (getsockname(s, (struct sockaddr *) &me, &alen) == -1) { | 442 | if (getsockname(s, (struct sockaddr *) &me, &alen) == -1) { |
@@ -451,9 +451,11 @@ int arping_main(int argc, char **argv) | |||
451 | he = me; | 451 | he = me; |
452 | memset(he.sll_addr, -1, he.sll_halen); | 452 | memset(he.sll_addr, -1, he.sll_halen); |
453 | 453 | ||
454 | if (!quiet) | 454 | if (!quiet) { |
455 | printf("ARPING to %s from %s via %s\n", inet_ntoa(dst), | 455 | printf("ARPING to %s", inet_ntoa(dst)); |
456 | inet_ntoa(src), device ? device : "unknown"); | 456 | printf(" from %s via %s\n", inet_ntoa(src), |
457 | device ? device : "unknown"); | ||
458 | } | ||
457 | 459 | ||
458 | if (!src.s_addr && !dad) { | 460 | if (!src.s_addr && !dad) { |
459 | error_msg("no src address in the non-DAD mode"); | 461 | error_msg("no src address in the non-DAD mode"); |