Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2018 11:08:38 +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-11@freebsd.org
Subject:   svn commit: r340943 - stable/11/sbin/route
Message-ID:  <201811261108.wAQB8ccV015887@repo.freebsd.org>

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

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" returned 0 in the same case. Fix it.
  
  PR:		186333

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

Modified: stable/11/sbin/route/route.c
==============================================================================
--- stable/11/sbin/route/route.c	Mon Nov 26 11:07:43 2018	(r340942)
+++ stable/11/sbin/route/route.c	Mon Nov 26 11:08:38 2018	(r340943)
@@ -1047,10 +1047,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)
@@ -1084,7 +1087,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?201811261108.wAQB8ccV015887>