Skip to content

Commit

Permalink
Paranoid checking of $proc->stat, in case it suddenly doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
SineSwiper committed Oct 17, 2015
1 parent 8856c55 commit 637d824
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/P9Y/ProcessTable/Role/Table/ProcFS.pm
Expand Up @@ -63,12 +63,16 @@ sub _process_hash {
my ($self, $pid) = @_;

my $pdir = dir('', 'proc', $pid);
return unless (-d $pdir);
return unless -d $pdir;

my $stat = $pdir->stat
return unless $stat;

my $hash = {
pid => $pid,
uid => $pdir->stat->uid,
gid => $pdir->stat->gid,
start => $pdir->stat->mtime, # not reliable
uid => $stat->uid,
gid => $stat->gid,
start => $stat->mtime, # not reliable
};

# process links
Expand Down

0 comments on commit 637d824

Please sign in to comment.