summaryrefslogtreecommitdiffstats
path: root/lib/MDK/Common/System.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-05-30 10:50:06 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-05-30 10:50:06 +0000
commit3de0694a24e8f21e36b5f65586ce032b6afeff13 (patch)
tree1135a50638f1cd7391834a758804a4f29a9b8305 /lib/MDK/Common/System.pm
parent1a06fa7e4a300880848047118f0adba68d38348d (diff)
downloadperl-MDK-Common-3de0694a24e8f21e36b5f65586ce032b6afeff13.tar
perl-MDK-Common-3de0694a24e8f21e36b5f65586ce032b6afeff13.tar.gz
perl-MDK-Common-3de0694a24e8f21e36b5f65586ce032b6afeff13.tar.bz2
perl-MDK-Common-3de0694a24e8f21e36b5f65586ce032b6afeff13.tar.xz
perl-MDK-Common-3de0694a24e8f21e36b5f65586ce032b6afeff13.zip
enhance fuzzy_pidofs() to handle kernel processes
Diffstat (limited to 'lib/MDK/Common/System.pm')
-rw-r--r--lib/MDK/Common/System.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/MDK/Common/System.pm b/lib/MDK/Common/System.pm
index a947523..b856e70 100644
--- a/lib/MDK/Common/System.pm
+++ b/lib/MDK/Common/System.pm
@@ -471,7 +471,15 @@ sub update_gnomekderc {
sub fuzzy_pidofs {
my ($regexp) = @_;
grep {
- /^(\d+)$/ && (MDK::Common::File::cat_("/proc/$_/cmdline") || readlink("/proc/$_/exe") || '') =~ /$regexp/;
+ if (/^(\d+)$/) {
+ my $s = MDK::Common::File::cat_("/proc/$_/cmdline") ||
+ readlink("/proc/$_/exe") ||
+ MDK::Common::File::cat_("/proc/$_/stat") =~ /\s(\S+)/ && $1 ||
+ '';
+ $s =~ /$regexp/;
+ } else {
+ 0;
+ }
} MDK::Common::File::all('/proc');
}