aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-12-11 22:00:41 +0100
committerAngelo Naselli <anaselli@linux.it>2014-12-11 22:00:41 +0100
commit8755839f9b033c3e53e6db40c079afd35ca919f7 (patch)
treeccb3afc2e42339a62562fffe11249b38f0f60ee9
parenta46751b036fe1d06f35122296c49543796b58643 (diff)
downloadmanatools-8755839f9b033c3e53e6db40c079afd35ca919f7.tar
manatools-8755839f9b033c3e53e6db40c079afd35ca919f7.tar.gz
manatools-8755839f9b033c3e53e6db40c079afd35ca919f7.tar.bz2
manatools-8755839f9b033c3e53e6db40c079afd35ca919f7.tar.xz
manatools-8755839f9b033c3e53e6db40c079afd35ca919f7.zip
Removed heading from ps list (caused an undefined value comparing)
-rw-r--r--lib/AdminPanel/Shared.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/AdminPanel/Shared.pm b/lib/AdminPanel/Shared.pm
index dbb9e194..5e5d2194 100644
--- a/lib/AdminPanel/Shared.pm
+++ b/lib/AdminPanel/Shared.pm
@@ -42,7 +42,6 @@ This module collects all the routines shared between AdminPanel and its modules.
inArray
disable_x_screensaver
enable_x_screensaver
- isRunning
isProcessRunning
=head1 SUPPORT
@@ -96,7 +95,6 @@ our @EXPORT_OK = qw(
inArray
disable_x_screensaver
enable_x_screensaver
- isRunning
isProcessRunning
);
@@ -365,9 +363,11 @@ sub enable_x_screensaver() {
sub isProcessRunning {
my ($name, $o_user) = @_;
my $user = $o_user || $ENV{USER};
- foreach (`ps -o '%P %p %c' -u $user`) {
+ my @proc = `ps -o '%P %p %c' -u $user`;
+ shift (@proc);
+ foreach (@proc) {
my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/;
- return $pid if $ppid != 1 && $pid != $$ && $n eq $name;
+ return $pid if $n eq $name && $ppid != 1 && $pid != $$;
}
return;
}