diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-19 23:15:46 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-19 23:15:46 +0000 |
commit | eded4f7a23932a878ae06ba41964411299db5efb (patch) | |
tree | 05a36e8cad639b9f33bc756a7ea1b738248d2a62 | |
parent | a6ef44b2074f30facb231b42d5c9264a02a7bb5f (diff) | |
download | busybox-w32-eded4f7a23932a878ae06ba41964411299db5efb.tar.gz busybox-w32-eded4f7a23932a878ae06ba41964411299db5efb.tar.bz2 busybox-w32-eded4f7a23932a878ae06ba41964411299db5efb.zip |
ifupdown: do not print and/or execute empty commands ("").
git-svn-id: svn://busybox.net/trunk/busybox@17010 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | networking/ifupdown.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 90c05444b..b53d2330d 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -291,9 +291,11 @@ static int execute(const char *command, struct interface_defn_t *ifd, execfn *ex | |||
291 | 291 | ||
292 | out = parse(command, ifd); | 292 | out = parse(command, ifd); |
293 | if (!out) { | 293 | if (!out) { |
294 | /* parse error? */ | ||
294 | return 0; | 295 | return 0; |
295 | } | 296 | } |
296 | ret = (*exec)(out); | 297 | /* out == "": parsed ok but not all needed variables known, skip */ |
298 | ret = out[0] ? (*exec)(out) : 1; | ||
297 | 299 | ||
298 | free(out); | 300 | free(out); |
299 | if (ret != 1) { | 301 | if (ret != 1) { |
@@ -903,15 +905,13 @@ static int doit(char *str) | |||
903 | if (option_mask32 & (OPT_no_act|OPT_verbose)) { | 905 | if (option_mask32 & (OPT_no_act|OPT_verbose)) { |
904 | puts(str); | 906 | puts(str); |
905 | } | 907 | } |
906 | /* FIXME: is it true that we can reach this place with str = ""? */ | ||
907 | /* how? in execute() parse() may return "", then we do (*exec)(""); */ | ||
908 | /* Please add a comment... */ | ||
909 | if (!(option_mask32 & OPT_no_act)) { | 908 | if (!(option_mask32 & OPT_no_act)) { |
910 | pid_t child; | 909 | pid_t child; |
911 | int status; | 910 | int status; |
912 | 911 | ||
913 | fflush(NULL); | 912 | fflush(NULL); |
914 | switch (child = fork()) { | 913 | child = fork(); |
914 | switch (child) { | ||
915 | case -1: /* failure */ | 915 | case -1: /* failure */ |
916 | return 0; | 916 | return 0; |
917 | case 0: /* child */ | 917 | case 0: /* child */ |
@@ -939,10 +939,8 @@ static int execute_all(struct interface_defn_t *ifd, const char *opt) | |||
939 | } | 939 | } |
940 | 940 | ||
941 | buf = xasprintf("run-parts /etc/network/if-%s.d", opt); | 941 | buf = xasprintf("run-parts /etc/network/if-%s.d", opt); |
942 | if (doit(buf) != 1) { | 942 | /* heh, we don't bother free'ing it */ |
943 | return 0; | 943 | return doit(buf); |
944 | } | ||
945 | return 1; | ||
946 | } | 944 | } |
947 | 945 | ||
948 | static int check(char *str) | 946 | static int check(char *str) |