Bugfix : Sometimes proccess are stopped between readir of /proc and analyze. This should not raise an error
This commit is contained in:
parent
4973e18ea1
commit
449cf97d71
4
memstats
4
memstats
|
@ -182,7 +182,7 @@ while (my $pid = readdir(DIR)) {
|
|||
|
||||
# Get owner name
|
||||
my $uid = 0;
|
||||
open(FIC,"</proc/$pid/status") or die $!;
|
||||
open(FIC,"</proc/$pid/status") or next; # Processus may have stopped between readdir and analyze
|
||||
while( defined( $l = <FIC> ) ) {
|
||||
if ($l =~ /Uid:\s+([0-9]+)\s+.*/)
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ while (my $pid = readdir(DIR)) {
|
|||
$quota,$comment,$gcos,$dir,$shell,$expire) = getpwuid($uid);
|
||||
|
||||
# Get infos
|
||||
open(FIC,"</proc/$pid/stat") or die $!;
|
||||
open(FIC,"</proc/$pid/stat") or next; # Processus may have stopped between readdir and analyze
|
||||
my @infos = split(/ /, <FIC>);
|
||||
close (FIC);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user