ntpd: explain why scripts can be run in quick succession
[oweals/busybox.git] / networking / ifupdown.c
index d0c5cce07b552865d7c52783beca20946d53bd21..51b36263f5ca8af8e68e4d098eb3b9730b239968 100644 (file)
@@ -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;
@@ -969,7 +969,7 @@ static int doit(char *str)
                pid_t child;
                int status;
 
-               fflush(NULL);
+               fflush_all();
                child = vfork();
                switch (child) {
                case -1: /* failure */
@@ -1038,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) {
@@ -1056,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;
 }
 
@@ -1142,7 +1142,7 @@ static llist_t *read_iface_state(void)
 
 
 int ifupdown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int ifupdown_main(int argc, char **argv)
+int ifupdown_main(int argc UNUSED_PARAM, char **argv)
 {
        int (*cmds)(struct interface_defn_t *);
        struct interfaces_file_t *defn;
@@ -1161,7 +1161,8 @@ int ifupdown_main(int argc, char **argv)
        }
 
        getopt32(argv, OPTION_STR, &interfaces);
-       if (argc - optind > 0) {
+       argv += optind;
+       if (argv[0]) {
                if (DO_ALL) bb_show_usage();
        } else {
                if (!DO_ALL) bb_show_usage();
@@ -1175,7 +1176,7 @@ int ifupdown_main(int argc, char **argv)
        if (DO_ALL) {
                target_list = defn->autointerfaces;
        } else {
-               llist_add_to_end(&target_list, argv[optind]);
+               llist_add_to_end(&target_list, argv[0]);
        }
 
        /* Update the interfaces */