From edc209d4479b6b89aed9cb5b661002cf27031bea Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Thu, 18 Feb 2016 14:05:58 +0100
Subject: [PATCH] ip: fix exit code for rule failures
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1288042
Upstream Status: iproute2.git commit 076ae7089a4b4
commit 076ae7089a4b4874a1aedd4c5f84bb889dcda34e
Author: Stephen Hemminger <shemming@brocade.com>
Date: Wed May 6 09:53:41 2015 -0700
ip: fix exit code for rule failures
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iprule.c b/ip/iprule.c
index d80b125..eebcda2 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -355,7 +355,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;
}
--
1.8.3.1