From 9094c77fd1c365a325d4d44a6ce59cbd90f95762 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 2 Sep 2005 17:28:28 +0000 Subject: Make a pid hash, not an array. now pids are only printed once git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@13 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- nagios-check-libs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nagios-check-libs b/nagios-check-libs index f38fcbc..de5c138 100755 --- a/nagios-check-libs +++ b/nagios-check-libs @@ -50,7 +50,7 @@ my %processes; sub getPIDs($$) { my ($user, $process) = @_; - return join(', ', sort @{ $processes{$user}->{$process} }); + return join(', ', sort keys %{ $processes{$user}->{$process} }); }; sub getProcs($) { my ($user) = @_; @@ -76,7 +76,7 @@ for my $line (@lsof) { if ($line =~ m/path inode=/) { my ($process, $pid, $user, $rest) = split /\s+/, $line; #$processes{$user}->{$process} = [] unless defined $processes{$user}->{$process}; - push @{ $processes{$user}->{$process} }, $pid; + $processes{$user}->{$process}->{$pid} = 1; }; }; -- cgit v1.2.3