Commit b6e987dc authored by Franco Fichtner's avatar Franco Fichtner

inc: remove a useless wrapper

parent 241ed34a
...@@ -1969,12 +1969,13 @@ function filter_nat_rules_generate() { ...@@ -1969,12 +1969,13 @@ function filter_nat_rules_generate() {
$natrules .= "\n# Reflection redirects and NAT for 1:1 mappings\n" . $reflection_txt; $natrules .= "\n# Reflection redirects and NAT for 1:1 mappings\n" . $reflection_txt;
// Check if inetd is running, if not start it. If so, restart it gracefully. // Check if inetd is running, if not start it. If so, restart it gracefully.
$helpers = isvalidproc("inetd"); $helpers = is_process_running('inetd');
if(file_exists("/var/etc/inetd.conf")) { if (file_exists('/var/etc/inetd.conf')) {
if(!$helpers) if (!$helpers) {
mwexec("/usr/sbin/inetd -wW -R 0 -a 127.0.0.1 /var/etc/inetd.conf"); mwexec("/usr/sbin/inetd -wW -R 0 -a 127.0.0.1 /var/etc/inetd.conf");
else } else {
sigkillbypid("/var/run/inetd.pid", "HUP"); sigkillbypid("/var/run/inetd.pid", "HUP");
}
} }
return $natrules; return $natrules;
......
...@@ -39,17 +39,13 @@ function isvalidpid($pidfile) { ...@@ -39,17 +39,13 @@ function isvalidpid($pidfile) {
return false; return false;
} }
function is_process_running($process) { function is_process_running($process)
$output = ""; {
exec("/bin/pgrep -anx " . escapeshellarg($process), $output, $retval); exec('/bin/pgrep -anx ' . escapeshellarg($process), $output, $retval);
return (intval($retval) == 0); return (intval($retval) == 0);
} }
function isvalidproc($proc) {
return is_process_running($proc);
}
/* sigkill a process by pid file */ /* sigkill a process by pid file */
/* return 1 for success and 0 for a failure */ /* return 1 for success and 0 for a failure */
function sigkillbypid($pidfile, $sig) { function sigkillbypid($pidfile, $sig) {
...@@ -62,7 +58,7 @@ function sigkillbypid($pidfile, $sig) { ...@@ -62,7 +58,7 @@ function sigkillbypid($pidfile, $sig) {
/* kill a process by name */ /* kill a process by name */
function killbyname($procname) function killbyname($procname)
{ {
if (isvalidproc($procname)) { if (is_process_running($procname)) {
mwexec('/usr/bin/killall ' . escapeshellarg($procname)); mwexec('/usr/bin/killall ' . escapeshellarg($procname));
} }
} }
......
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