Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2018 11:05:27 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r340940 - stable/12/sbin/route
Message-ID:  <201811261105.wAQB5RCZ015546@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen
Date: Mon Nov 26 11:05:26 2018
New Revision: 340940
URL: https://svnweb.freebsd.org/changeset/base/340940

Log:
  MFC r339811: route(8): correctly return exit status when "-q" flag
  is used.
  
    Previously, route returned 1 in case of error  properly signalling
    failure but "route -q" it returned 0 for same case. Fix it.
  
  PR:		186333

Modified:
  stable/12/sbin/route/route.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/route/route.c
==============================================================================
--- stable/12/sbin/route/route.c	Mon Nov 26 11:04:35 2018	(r340939)
+++ stable/12/sbin/route/route.c	Mon Nov 26 11:05:26 2018	(r340940)
@@ -1050,10 +1050,13 @@ newroute(int argc, char **argv)
 			}
 			printf("\n");
 		}
+	}
 
-		fibnum = 0;
-		TAILQ_FOREACH(fl, &fibl_head, fl_next) {
-			if (fl->fl_error != 0) {
+	fibnum = 0;
+	TAILQ_FOREACH(fl, &fibl_head, fl_next) {
+		if (fl->fl_error != 0) {
+			error = 1;
+			if (!qflag) {
 				printf("%s %s %s", cmd, (nrflags & F_ISHOST)
 				    ? "host" : "net", dest);
 				if (*gateway)
@@ -1087,7 +1090,6 @@ newroute(int argc, char **argv)
 					break;
 				}
 				printf(": %s\n", errmsg);
-				error = 1;
 			}
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811261105.wAQB5RCZ015546>