Skip to content

Commit f06c6f4

Browse files
authored
patch: explicit eof check
When patching a file that has already been patched, the line loop contains a nested "readline" which needs to terminate the loop if EOF is detected. I put this in a new commit so the last commit was more obvious that it was only restoring old code.
1 parent c47e9da commit f06c6f4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bin/patch

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,10 @@ sub index {
867867
my $fail;
868868
for (1..$#$match) {
869869
my $line = <$in>;
870+
unless (defined $line) {
871+
$fail++;
872+
last;
873+
}
870874
$line =~ s/\s+/ /g if $self->{'ignore-whitespace'};
871875
$line eq $match->[$_] or $fail++, last;
872876
}

0 commit comments

Comments
 (0)