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;
                        }
                }
        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to