From c8d4f4372a84ad74ba3f85aa380a6cda04d63710 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Wed, 7 Dec 2011 18:16:09 +0100 Subject: [PATCH] The return value of nameif was wrong Steps to Reproduce: /sbin/nameif eth1 00:00:10:10:11:11; echo $? Actual Results: interface 'eth1' not found 0 Expected Results: interface 'eth1' not found 1 --- nameif.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nameif.c b/nameif.c index 04658c5..209d492 100644 --- a/nameif.c +++ b/nameif.c @@ -210,6 +210,7 @@ int main(int ac, char **av) int linenum; char *line = NULL; size_t linel = 0; + int ret = 0; for (;;) { int c = getopt_long(ac,av,"c:s",lopt,NULL); @@ -288,13 +289,15 @@ int main(int ac, char **av) while (clist) { struct change *ch = clist; clist = clist->next; - if (!ch->found) + if (!ch->found){ warning(_("interface '%s' not found"), ch->ifname); + ret = 1; + } free(ch); } if (use_syslog) closelog(); - return 0; + return ret; } -- 2.7.4