Module Name:    src
Committed By:   ozaki-r
Date:           Wed Nov  4 07:59:25 UTC 2015

Modified Files:
        src/sbin/ping6: ping6.c

Log Message:
Fix exit status when -c and -X is used

It exited with status 0 when at least one packet was received
and timed out. However, when we specify -c N (while N > 0),
we expect that it fails if it times out before all sent requests
are replied.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sbin/ping6/ping6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.89 src/sbin/ping6/ping6.c:1.90
--- src/sbin/ping6/ping6.c:1.89	Wed Nov  4 01:14:02 2015
+++ src/sbin/ping6/ping6.c	Wed Nov  4 07:59:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.89 2015/11/04 01:14:02 knakahara Exp $	*/
+/*	$NetBSD: ping6.c,v 1.90 2015/11/04 07:59:25 ozaki-r Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.89 2015/11/04 01:14:02 knakahara Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.90 2015/11/04 07:59:25 ozaki-r Exp $");
 #endif
 #endif
 
@@ -1146,7 +1146,10 @@ main(int argc, char *argv[])
 			break;
 	}
 	summary();
-	exit(nreceived == 0);
+	if (npackets)
+		exit(nreceived != npackets);
+	else
+		exit(nreceived == 0);
 }
 
 static void

Reply via email to