mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: ping: return an error exit code when connection fails
@ 2015-03-16 15:02 Mirko Damiani
  2015-03-16 16:09 ` mirko
  0 siblings, 1 reply; 3+ messages in thread
From: Mirko Damiani @ 2015-03-16 15:02 UTC (permalink / raw)
  To: barebox

Hi,
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>
---
  net/ping.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ping.c b/net/ping.c
index 2349f4b..4eb77cb 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;
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ping: return an error exit code when connection fails
  2015-03-16 15:02 [PATCH] net: ping: return an error exit code when connection fails Mirko Damiani
@ 2015-03-16 16:09 ` mirko
  2015-03-17  7:11   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: mirko @ 2015-03-16 16:09 UTC (permalink / raw)
  To: barebox

Il 2015-03-16 16:02 Mirko Damiani ha scritto:
> Hi,
> 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.
> 

Sorry, the same patch with proper tabulation characters.


Signed-off-by: Mirko Damiani <mirko@develer.com>
---
  net/ping.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ping.c b/net/ping.c
index 2349f4b..4eb77cb 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;
-- 
1.9.1

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ping: return an error exit code when connection fails
  2015-03-16 16:09 ` mirko
@ 2015-03-17  7:11   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2015-03-17  7:11 UTC (permalink / raw)
  To: mirko; +Cc: barebox

Hi Mirko,

On Mon, Mar 16, 2015 at 05:09:17PM +0100, mirko wrote:
> Il 2015-03-16 16:02 Mirko Damiani ha scritto:
> >Hi,
> >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.
> >
> 
> Sorry, the same patch with proper tabulation characters.

I can confirm that this patch now has tabs instead of spaces, but it
still does not apply because there are some spaces in the context which
shouldn't be there. Anyway, applied it manually, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-17  7:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-16 15:02 [PATCH] net: ping: return an error exit code when connection fails Mirko Damiani
2015-03-16 16:09 ` mirko
2015-03-17  7:11   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox