fix ip -force -batch to continue on errors
This patch replaces exits with returns in several
iproute2 commands. This fixes `ip -batch -force`
to not exit but continue on errors.
$cat c.txt
route del 1.2.3.0/24 dev eth0
route del 1.2.4.0/24 dev eth0
route del 1.2.5.0/24 dev eth0
route add 1.2.3.0/24 dev eth0
$ip -force -batch c.txt
RTNETLINK answers: No such process
Command failed c.txt:2
RTNETLINK answers: No such process
Command failed c.txt:3
Reported-by: Sven-Haegar Koch <haegar@sdinet.de>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 9f6c84e..2ae739c 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -80,7 +80,7 @@
if (d == NULL || vid == -1) {
fprintf(stderr, "Device and VLAN ID are required arguments.\n");
- exit(-1);
+ return -1;
}
req.ifm.ifi_index = ll_name_to_index(d);
@@ -132,7 +132,7 @@
addattr_nest_end(&req.n, afspec);
if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0)
- exit(2);
+ return -1;
return 0;
}