| 1 | Description: fix for undef input into regex match |
| 2 | Author: Alexander Zangerl <[email protected]> |
| 3 | --- a/File.pm |
| 4 | +++ b/File.pm |
| 5 | @@ -285,7 +285,8 @@ sub read { |
| 6 | || die qq/Cannot open pid file "$self->{path}": $!\n/; |
| 7 | flock($fh, LOCK_EX | LOCK_NB) |
| 8 | || die qq/pid "$self->{path}" already locked: $!\n/; |
| 9 | - my ($pid) = <$fh> =~ /^(\d+)/; |
| 10 | + my $maybe = <$fh>; |
| 11 | + my ($pid) = $maybe =~ /^(\d+)/ if (defined $maybe); |
| 12 | close $fh if @_ == 1; |
| 13 | |
| 14 | $self->debug("read(\"$self->{path}\") = " . ($pid || "")); |