Skip to content

Commit

Permalink
t: handle EOF in test_copy_bytes()
Browse files Browse the repository at this point in the history
The test_copy_bytes() function claims to read up to N bytes,
or until it gets EOF. But we never handle EOF in our loop,
and a short input will cause perl to go into an infinite
loop of read() getting zero bytes.

Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Jul 17, 2017
1 parent 08f9c32 commit f7f6dc3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions t/test-lib-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ test_copy_bytes () {
my $s;
my $nread = sysread(STDIN, $s, $len);
die "cannot read: $!" unless defined($nread);
last unless $nread;
print $s;
$len -= $nread;
}
Expand Down

0 comments on commit f7f6dc3

Please sign in to comment.