Blob Blame History Raw
Description: fix for undef input into regex match
Author: Alexander Zangerl <az@debian.org>
--- a/File.pm
+++ b/File.pm
@@ -285,7 +285,8 @@ sub read {
 		|| die qq/Cannot open pid file "$self->{path}": $!\n/;
 	flock($fh, LOCK_EX | LOCK_NB)
         || die qq/pid "$self->{path}" already locked: $!\n/;
-	my ($pid) = <$fh> =~ /^(\d+)/;
+	my $maybe = <$fh>;
+	my ($pid) = $maybe =~ /^(\d+)/ if (defined $maybe);
 	close $fh if @_ == 1;
 
 	$self->debug("read(\"$self->{path}\") = " . ($pid || ""));