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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
08f9c32463
commit
f7f6dc340e
@ -999,6 +999,7 @@ test_copy_bytes () {
|
|||||||
my $s;
|
my $s;
|
||||||
my $nread = sysread(STDIN, $s, $len);
|
my $nread = sysread(STDIN, $s, $len);
|
||||||
die "cannot read: $!" unless defined($nread);
|
die "cannot read: $!" unless defined($nread);
|
||||||
|
last unless $nread;
|
||||||
print $s;
|
print $s;
|
||||||
$len -= $nread;
|
$len -= $nread;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user