networking(): check first ifup exists

Check first ifup exists before using it since
   this is really something only exits on some
   distros an in different ways. Debian/Ubunu has
   an package for this while others have it in the
   initscripts package(s) , meaning the file can be
   around even without the prog.

Signed-off-by: crazy <crazy@frugalware.org>
This commit is contained in:
crazy committed 2017-03-28 13:21:20 +02:00
1 parent a44daf20cb
commit 885056a6c9
1 file changed
+4 -1
+4 -1
View File
@@ -155,7 +155,9 @@ static void networking(void)
return; return;
} }
/* Debian/Ubuntu/Busybox interfaces file */ /* Debian/Ubuntu/Busybox/RH/Suse */
if (fexist("/sbin/ifup")) {
/* interfaces file */
fp = fopen("/etc/network/interfaces", "r"); fp = fopen("/etc/network/interfaces", "r");
if (fp) { if (fp) {
int i = 0; int i = 0;
@@ -186,6 +188,7 @@ static void networking(void)
if (i) if (i)
return; return;
} }
}
/* Fall back to bring up at least loopback */ /* Fall back to bring up at least loopback */
ifconfig("lo", "127.0.0.1", "255.0.0.0", 1); ifconfig("lo", "127.0.0.1", "255.0.0.0", 1);