Skip to content

Commit f7f6dc3

Browse files
peffgitster
authored andcommitted
t: handle EOF in test_copy_bytes()
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]>
1 parent 08f9c32 commit f7f6dc3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

t/test-lib-functions.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ test_copy_bytes () {
999999
my $s;
10001000
my $nread = sysread(STDIN, $s, $len);
10011001
die "cannot read: $!" unless defined($nread);
1002+
last unless $nread;
10021003
print $s;
10031004
$len -= $nread;
10041005
}

0 commit comments

Comments
 (0)