Author: eugen
Date: Sat Oct 27 07:59:19 2018
New Revision: 339811
URL: https://svnweb.freebsd.org/changeset/base/339811

Log:
  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
  MFC after:    1 month

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==============================================================================
--- head/sbin/route/route.c     Sat Oct 27 07:32:26 2018        (r339810)
+++ head/sbin/route/route.c     Sat Oct 27 07:59:19 2018        (r339811)
@@ -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;
                        }
                }
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to