From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from neo.develer.net ([2.228.72.10]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YXXaI-00060e-Fz for barebox@lists.infradead.org; Mon, 16 Mar 2015 16:09:43 +0000 Received: from webmail.develer.com (neo.develer.net [IPv6:2001:b02:400:1::10]) (Authenticated sender: mirko) by neo.develer.net (Postfix) with ESMTPSA id 489565E10EA for ; Mon, 16 Mar 2015 17:09:17 +0100 (CET) MIME-Version: 1.0 Date: Mon, 16 Mar 2015 17:09:17 +0100 From: mirko In-Reply-To: <5506F091.2040009@develer.com> References: <5506F091.2040009@develer.com> Message-ID: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH] net: ping: return an error exit code when connection fails To: barebox@lists.infradead.org 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 --- 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