From: Paul Cruz Date: Tue, 20 Jun 2017 21:33:08 +0000 (-0700) Subject: added tests with null files, changed condition to check that the file is more than... X-Git-Tag: v1.3.0~1^2~21^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a73c2a444aa13ef1d2932ae13f565fea71382fa5;p=thirdparty%2Fzstd.git added tests with null files, changed condition to check that the file is more than 0 bytes --- diff --git a/programs/fileio.c b/programs/fileio.c index bf65ba528..a5db88a4c 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -889,7 +889,7 @@ static int getFileInfo(fileInfo_t* info, const char* inFileName){ BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX]; size_t const numBytesRead = fread(headerBuffer, 1, sizeof(headerBuffer), srcFile); if (numBytesRead < ZSTD_frameHeaderSize_min) { - if (feof(srcFile) && numBytesRead == 0) { + if (feof(srcFile) && numBytesRead == 0 && info->compressedSize > 0) { break; } else if (feof(srcFile)) { diff --git a/tests/playTests.sh b/tests/playTests.sh index 7792a5690..21f79c715 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -564,6 +564,14 @@ $ECHO "\n**** zstd --list/-l error detection tests ****" ! $ZSTD -lv tmp1* ! $ZSTD --list -v tmp2 tmp23.zst +$ECHO "\n**** zstd --list/-l test with null files ****" +./datagen -g0 > tmp5 +$ZSTD tmp5 +! $ZSTD -l tmp5* +! $ZSTD -lv tmp5* +! $ZSTD --list tmp5* +! $ZSTD --list -v tmp5* + rm tmp* if [ "$1" != "--test-large-data" ]; then