Clean environment variables before running init scripts

This commit is contained in:
Jamie Cameron
2013-02-19 22:07:26 -08:00
parent ac95852b5c
commit ebc41abfc4
3 changed files with 6 additions and 0 deletions

View File

@@ -1120,7 +1120,9 @@ if ($action_mode eq "init" || $action_mode eq "local") {
if (!-x $fn) {
return (0, "$fn does not exist");
}
&clean_environment();
local $out = &backquote_logged("$fn start 2>&1 </dev/null");
&reset_environment();
local $ex = $?;
return (!$ex, $out);
}

View File

@@ -62,7 +62,9 @@ if ($start || $stop || $restart) {
"stop");
print &text('ss_exec', "<tt>$cmd</tt>"),"<p>\n";
print "<pre>";
&clean_environment();
&foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0, STDOUT, undef, 1);
&reset_environment();
print "</pre>\n";
push(@selacts, $acts[$idx]);
}

View File

@@ -25,7 +25,9 @@ $SIG{'TERM'} = sub { };
# Run the command
print &text('ss_exec', "<tt>$cmd</tt>"),"<p>\n";
print "<pre>";
&clean_environment();
&foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0, STDOUT, undef, 1);
&reset_environment();
print "</pre>\n";
&webmin_log($action, 'action', $in{'name'});