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() {
$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.
$helpers = isvalidproc("inetd");
if(file_exists("/var/etc/inetd.conf")) {
if(!$helpers)
$helpers = is_process_running('inetd');
if (file_exists('/var/etc/inetd.conf')) {
if (!$helpers) {
mwexec("/usr/sbin/inetd -wW -R 0 -a 127.0.0.1 /var/etc/inetd.conf");
else
} else {
sigkillbypid("/var/run/inetd.pid", "HUP");
}
}
return $natrules;
......
......@@ -39,17 +39,13 @@ function isvalidpid($pidfile) {
return false;
}
function is_process_running($process) {
$output = "";
exec("/bin/pgrep -anx " . escapeshellarg($process), $output, $retval);
function is_process_running($process)
{
exec('/bin/pgrep -anx ' . escapeshellarg($process), $output, $retval);
return (intval($retval) == 0);
}
function isvalidproc($proc) {
return is_process_running($proc);
}
/* sigkill a process by pid file */
/* return 1 for success and 0 for a failure */
function sigkillbypid($pidfile, $sig) {
......@@ -62,7 +58,7 @@ function sigkillbypid($pidfile, $sig) {
/* kill a process by name */
function killbyname($procname)
{
if (isvalidproc($procname)) {
if (is_process_running($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