diff options
author | Mirko Damiani <mirko@develer.com> | 2015-03-16 16:02:41 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-04-03 08:03:08 +0200 |
commit | e44c9b04c4cb96e09c2d7a5caf91bfb56d08729b (patch) | |
tree | 56103bbc1f540fc58ee448e66dbef2b3fe15b932 /net | |
parent | 712da9305d4c3e60a223d53c1692d295060fbf4c (diff) | |
download | barebox-e44c9b04c4cb96e09c2d7a5caf91bfb56d08729b.tar.gz barebox-e44c9b04c4cb96e09c2d7a5caf91bfb56d08729b.tar.xz |
net: ping: return an error exit code when connection fails
ping command does not always returns 1 as exit code when connection to
host fails. In particular it returns the exit code of the previous run.
This patch fixes this issue.
Signed-off-by: Mirko Damiani <mirko@develer.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/ping.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ping.c b/net/ping.c index 2349f4bed3..4eb77cb785 100644 --- a/net/ping.c +++ b/net/ping.c @@ -67,6 +67,9 @@ static int do_ping(int argc, char *argv[]) return 1; } + ping_state = PING_STATE_INIT; + ping_sequence_number = 0; + ping_con = net_icmp_new(net_ping_ip, ping_handler, NULL); if (IS_ERR(ping_con)) { ret = PTR_ERR(ping_con); @@ -78,9 +81,6 @@ static int do_ping(int argc, char *argv[]) if (ret) goto out_unreg; - ping_state = PING_STATE_INIT; - ping_sequence_number = 0; - while (ping_state == PING_STATE_INIT) { if (ctrlc()) { ret = -EINTR; |