Unverified Commit d987c5da by Stéphane Graber Committed by GitHub

Merge pull request #2022 from 3XX0/exec-run-script

conf: avoid spawning unnecessary subshells
parents 5875fa24 6d1a5f93
......@@ -355,10 +355,11 @@ static int run_script_argv(const char *name, const char *section,
size += strlen(hook) + 1;
size += strlen("exec");
size += strlen(script);
size += strlen(name);
size += strlen(section);
size += 3;
size += 4;
if (size > INT_MAX)
return -1;
......@@ -370,7 +371,7 @@ static int run_script_argv(const char *name, const char *section,
}
ret =
snprintf(buffer, size, "%s %s %s %s", script, name, section, hook);
snprintf(buffer, size, "exec %s %s %s %s", script, name, section, hook);
if (ret < 0 || (size_t)ret >= size) {
ERROR("Script name too long.");
return -1;
......@@ -405,10 +406,11 @@ int run_script(const char *name, const char *section, const char *script, ...)
size += strlen(p) + 1;
va_end(ap);
size += strlen("exec");
size += strlen(script);
size += strlen(name);
size += strlen(section);
size += 3;
size += 4;
if (size > INT_MAX)
return -1;
......@@ -419,7 +421,7 @@ int run_script(const char *name, const char *section, const char *script, ...)
return -1;
}
ret = snprintf(buffer, size, "%s %s %s", script, name, section);
ret = snprintf(buffer, size, "exec %s %s %s", script, name, section);
if (ret < 0 || ret >= size) {
ERROR("Script name too long.");
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment