diff options
| author | Roy Marples <roy@marples.name> | 2019-03-25 12:17:07 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-03-25 12:17:07 +0000 |
| commit | f17480d3e1e914d03fea0c054a028fe979742950 (patch) | |
| tree | 5606bae2168ca11b3a141beea1103b4180cd310f | |
| parent | 4f5eeb1d6a03e4facad3c8a48723fbdbe8458fbc (diff) | |
| download | dhcpcd-f17480d3e1e914d03fea0c054a028fe979742950.tar.xz | |
script: Fix not running when empty string or /dev/null
| -rw-r--r-- | src/if-options.c | 4 | ||||
| -rw-r--r-- | src/script.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/if-options.c b/src/if-options.c index 06c47b05..9ef3bdbb 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -709,6 +709,10 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, case 'c': ARG_REQUIRED; free(ifo->script); + if (*arg == '\0' || strcmp(arg, "/dev/null") == 0) { + ifo->script = NULL; + break; + } ifo->script = strdup(arg); if (ifo->script == NULL) logerr(__func__); diff --git a/src/script.c b/src/script.c index ba4ce03b..800c4c31 100644 --- a/src/script.c +++ b/src/script.c @@ -704,9 +704,7 @@ script_runreason(const struct interface *ifp, const char *reason) int status = 0; struct fd_list *fd; - if (ifp->options->script && - (ifp->options->script[0] == '\0' || - strcmp(ifp->options->script, "/dev/null") == 0) && + if (ifp->options->script == NULL || TAILQ_FIRST(&ifp->ctx->control_fds) == NULL) return 0; |
