From: Roy Marples Date: Wed, 3 Jun 2015 10:13:37 +0000 (+0000) Subject: Even if the script is /dev/null or NULL, always send the scripted environment X-Git-Tag: v6.9.1~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8bf1ba44ac5e3abce8a0529e4b9677a3aedc41;p=thirdparty%2Fdhcpcd.git Even if the script is /dev/null or NULL, always send the scripted environment to our listeners. --- diff --git a/script.c b/script.c index 66985a83..74338055 100644 --- a/script.c +++ b/script.c @@ -622,20 +622,27 @@ script_runreason(const struct interface *ifp, const char *reason) if (ifp->options->script && (ifp->options->script[0] == '\0' || - strcmp(ifp->options->script, "/dev/null") == 0)) + strcmp(ifp->options->script, "/dev/null") == 0) && + TAILQ_FIRST(&ifp->ctx->control_fds) == NULL) return 0; - argv[0] = ifp->options->script ? ifp->options->script : UNCONST(SCRIPT); - argv[1] = NULL; - logger(ifp->ctx, LOG_DEBUG, "%s: executing `%s' %s", - ifp->name, argv[0], reason); - /* Make our env */ elen = (size_t)make_env(ifp, reason, &env); if (elen == (size_t)-1) { logger(ifp->ctx, LOG_ERR, "%s: make_env: %m", ifp->name); return -1; } + + if (ifp->options->script && + (ifp->options->script[0] == '\0' || + strcmp(ifp->options->script, "/dev/null") == 0)) + goto send_listeners; + + argv[0] = ifp->options->script ? ifp->options->script : UNCONST(SCRIPT); + argv[1] = NULL; + logger(ifp->ctx, LOG_DEBUG, "%s: executing `%s' %s", + ifp->name, argv[0], reason); + /* Resize for PATH and RC_SVCNAME */ svcname = getenv(RC_SVCNAME); ep = realloc(env, sizeof(char *) * (elen + 2 + (svcname ? 1 : 0))); @@ -694,6 +701,7 @@ script_runreason(const struct interface *ifp, const char *reason) __func__, argv[0], strsignal(WTERMSIG(status))); } +send_listeners: /* Send to our listeners */ bigenv = NULL; status = 0;