{NULL, 0, NULL, '\0'}
};
+static const char *default_script = SCRIPT;
+
static char *
add_environ(struct if_options *ifo, const char *value, int uniq)
{
break;
case 'c':
ARG_REQUIRED;
- free(ifo->script);
+ if (ifo->script != default_script)
+ free(ifo->script);
s = parse_string(NULL, 0, arg);
if (s == 0) {
ifo->script = NULL;
}
dl = (size_t)s;
if (s == -1 || (ifo->script = malloc(dl)) == NULL) {
+ ifo->script = NULL;
logerr(__func__);
return -1;
}
ifo->options |= DHCPCD_IF_UP | DHCPCD_LINK | DHCPCD_INITIAL_DELAY;
ifo->timeout = DEFAULT_TIMEOUT;
ifo->reboot = DEFAULT_REBOOT;
+ ifo->script = UNCONST(default_script);
ifo->metric = -1;
ifo->auth.options |= DHCPCD_AUTH_REQUIRE;
TAILQ_INIT(&ifo->routes);
free(ifo->config);
}
rt_headclear0(ctx, &ifo->routes, AF_UNSPEC);
- free(ifo->script);
+ if (ifo->script != default_script)
+ free(ifo->script);
free(ifo->arping);
free(ifo->blacklist);
free(ifo->fallback);
if (ifp->options->script == NULL)
goto send_listeners;
- argv[0] = ifp->options->script ? ifp->options->script : UNCONST(SCRIPT);
+ argv[0] = ifp->options->script;
argv[1] = NULL;
logdebugx("%s: executing `%s' %s", ifp->name, argv[0], reason);