Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping6 Fix exit status when -c and -X is used



details:   https://anonhg.NetBSD.org/src/rev/ba7ed3a9c45f
branches:  trunk
changeset: 341394:ba7ed3a9c45f
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Nov 04 07:59:25 2015 +0000

description:
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.

diffstat:

 sbin/ping6/ping6.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r b528faa438e5 -r ba7ed3a9c45f sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Wed Nov 04 05:11:16 2015 +0000
+++ b/sbin/ping6/ping6.c        Wed Nov 04 07:59:25 2015 +0000
@@ -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 @@
 #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 @@
                        break;
        }
        summary();
-       exit(nreceived == 0);
+       if (npackets)
+               exit(nreceived != npackets);
+       else
+               exit(nreceived == 0);
 }
 
 static void



Home | Main Index | Thread Index | Old Index