aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-09-06 23:01:16 +0000
committerMike Frysinger <vapier@gentoo.org>2009-09-06 23:01:16 +0000
commit0529337c373d37b8bb38a86e7c715bc2b8a8244e (patch)
tree96bc87ace697f09cdd70309fd4466154f9b66183
parentslattach: use fchown() rather than chown() to avoid race between creation and... (diff)
downloadnet-tools-0529337c373d37b8bb38a86e7c715bc2b8a8244e.tar.gz
net-tools-0529337c373d37b8bb38a86e7c715bc2b8a8244e.tar.bz2
net-tools-0529337c373d37b8bb38a86e7c715bc2b8a8244e.zip
ifconfig: fix no output when if_readlist_proc() fails
The rewrite of if_readlist() on 28 Jun 2003 broke the function when the proc interface isn't readable. Have if_readlist() return an error only if both if_readxxx funcs failed. This fixes Gentoo 238363.
-rw-r--r--lib/interface.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/interface.c b/lib/interface.c
index f6f8906..d08ee55 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -7,7 +7,7 @@
8/2000 Andi Kleen make the list operations a bit more efficient.
People are crazy enough to use thousands of aliases now.
- $Id: interface.c,v 1.31 2009/07/08 00:24:03 ecki Exp $
+ $Id: interface.c,v 1.32 2009/09/06 23:01:16 vapier Exp $
*/
#include "config.h"
@@ -382,14 +382,17 @@ int if_readlist(void)
/* caller will/should check not to call this too often
* (i.e. only if if_list_all == 0
*/
- int err = 0;
+ int proc_err, conf_err;
- err |= if_readlist_proc(NULL);
- err |= if_readconf();
+ proc_err = if_readlist_proc(NULL);
+ conf_err = if_readconf();
if_list_all = 1;
- return err;
+ if (proc_err < 0 && conf_err < 0)
+ return -1;
+ else
+ return 0;
}
/* Support for fetching an IPX address */