summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-07-16 10:45:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-07-17 21:55:43 (GMT)
commitf7f6dc340ed4eb2bddc41993e112f8f18fcc1598 (patch)
tree4c44441f54672b63d29b137eeff9c69edc57442d /t/test-lib-functions.sh
parent08f9c32463bf9e578acb7ac5f77afd36e803c6bc (diff)
downloadgit-f7f6dc340ed4eb2bddc41993e112f8f18fcc1598.zip
git-f7f6dc340ed4eb2bddc41993e112f8f18fcc1598.tar.gz
git-f7f6dc340ed4eb2bddc41993e112f8f18fcc1598.tar.bz2
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>
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index db622c3..50a9a1d 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -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;
}