]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: fix exit code for rule failures
authorStephen Hemminger <shemming@brocade.com>
Wed, 6 May 2015 16:53:41 +0000 (09:53 -0700)
committerStephen Hemminger <shemming@brocade.com>
Thu, 7 May 2015 15:11:30 +0000 (08:11 -0700)
If ip rule command fails talking to kernel, exit code should be 2.
The sub-command is called by cmd loop and the exit code is negative
of return value from the command callback.

ip/iprule.c

index 967969c0e60e2f281ce1d4a1b45ac7b27091e757..986a5bcbab15c9e2a240cf3ed350484bcbc220d1 100644 (file)
@@ -381,7 +381,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
                req.r.rtm_table = RT_TABLE_MAIN;
 
        if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0)
-               return 2;
+               return -2;
 
        return 0;
 }