init: fix logically inverted FEATURE_EXTRA_QUIET check
[oweals/busybox.git] / networking / ifupdown.c
index 7a9709e403bc557de85f0963c494cbc06bc3c169..d28c0b86771583cf7bb60f956e2805fa2d746f7b 100644 (file)
  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
  */
 
+#include "libbb.h"
+/* After libbb.h, since it needs sys/types.h on some systems */
 #include <sys/utsname.h>
 #include <fnmatch.h>
 
-#include "libbb.h"
-
 #define MAX_OPT_DEPTH 10
 #define EUNBALBRACK 10001
 #define EUNDEFVAR   10002
@@ -522,7 +522,7 @@ static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
        bb_error_msg("no dhcp clients found");
        return 0;
 }
-#elif ENABLE_APP_UDHCPC
+#elif ENABLE_UDHCPC
 static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
 {
 #if ENABLE_FEATURE_IFUPDOWN_IP
@@ -569,7 +569,7 @@ static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
        result += static_down(ifd, exec);
        return ((result == 3) ? 3 : 0);
 }
-#elif ENABLE_APP_UDHCPC
+#elif ENABLE_UDHCPC
 static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
 {
        int result;
@@ -644,6 +644,9 @@ static const struct address_family_t addr_inet = {
 
 #endif /* if ENABLE_FEATURE_IFUPDOWN_IPV4 */
 
+/* Returns pointer to the next word, or NULL.
+ * In 1st case, advances *buf to the word after this one.
+ */
 static char *next_word(char **buf)
 {
        unsigned length;
@@ -663,7 +666,7 @@ static char *next_word(char **buf)
        if (word[length] != '\0')
                word[length++] = '\0';
 
-       *buf = word + length;
+       *buf = skip_whitespace(word + length);
 
        return word;
 }
@@ -966,7 +969,7 @@ static int doit(char *str)
                pid_t child;
                int status;
 
-               fflush(NULL);
+               fflush_all();
                child = vfork();
                switch (child) {
                case -1: /* failure */
@@ -1035,7 +1038,7 @@ static int popen2(FILE **in, FILE **out, char *command, char *param)
        xpiped_pair(infd);
        xpiped_pair(outfd);
 
-       fflush(NULL);
+       fflush_all();
        pid = vfork();
 
        switch (pid) {
@@ -1053,8 +1056,8 @@ static int popen2(FILE **in, FILE **out, char *command, char *param)
        /* parent */
        close(infd.rd);
        close(outfd.wr);
-       *in = fdopen(infd.wr, "w");
-       *out = fdopen(outfd.rd, "r");
+       *in = xfdopen_for_write(infd.wr);
+       *out = xfdopen_for_read(outfd.rd);
        return pid;
 }