ntpd: add -q option. By Adam Tkac.
[oweals/busybox.git] / networking / ifupdown.c
index 6b9449213baef36c01ca62e3b4297cb22da5448d..b16186ec728b2edc121afb7e2369af83142d7dea 100644 (file)
@@ -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;
 }