>Number:         186333
>Category:       bin
>Synopsis:       route(8) fails to return correct exit status in quiet mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 01 08:30:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Grosbein
>Release:        FreeBSD 9.2-STABLE amd64
>Organization:
RDTC JSC
>Environment:
System: FreeBSD grosbein.net 9.2-STABLE FreeBSD 9.2-STABLE #8 r256953M: Sat Nov 
23 01:01:28 NOVT 2013 [email protected]:/usr/obj/usr/local/src/sys/DADV amd64

>Description:

        Exit status of route(8) command in case of failure
        depends of presence of '-q' flags: exit status is always 0 with '-q'.

>How-To-Repeat:

# route delete default
delete net default fib 0
# route -q change default 10.58.0.1; echo $?
route: writing to routing socket: No such process
0
# route change default 10.58.0.1; echo $?
route: writing to routing socket: No such process
change net default: gateway 10.58.0.1 fib 0: not in table
1

>Fix:

--- sbin/route/route.c.orig     2013-10-21 20:58:24.000000000 +0700
+++ sbin/route/route.c  2014-02-01 15:05:00.000000000 +0700
@@ -994,8 +994,8 @@ newroute(int argc, char **argv)
        if (*cmd == 'g' || *cmd == 's')
                exit(error);
 
-       error = 0;
        if (!qflag) {
+               error = 0;
                fibnum = 0;
                TAILQ_FOREACH(fl, &fibl_head, fl_next) {
                        if (fl->fl_error == 0)
@@ -1066,6 +1066,8 @@ newroute(int argc, char **argv)
                        }
                }
        }
+       else
+               error = -error;
        exit(error);
 }
 


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to