From: Yann Collet Date: Tue, 25 Aug 2015 16:41:46 +0000 (+0100) Subject: Fixed #42 X-Git-Tag: v0.1.1^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b147600f9ece047159abfad03a94c0e2cd86e6a;p=thirdparty%2Fzstd.git Fixed #42 --- diff --git a/programs/Makefile b/programs/Makefile index b90cfdcef..525832453 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -123,6 +123,9 @@ test32: test-zstd32 test-fullbench32 test-fuzzer32 test-all: test test32 test-mem test-zstd: zstd datagen + @echo "*** zstd cli write error test ***" + echo foo | ./zstd > /dev/full; if [ $$? -eq 0 ] ; then echo "write error not detected!"; false; fi + @echo "*** zstd round-trip tests *** " ./datagen | ./zstd -v | ./zstd -d > $(VOID) ./datagen -g256MB | ./zstd -v | ./zstd -d > $(VOID) ./datagen -g6GB -P99 | ./zstd -vq | ./zstd -d > $(VOID) diff --git a/programs/fileio.c b/programs/fileio.c index d1c4a7c7f..82fce992e 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -52,6 +52,7 @@ #include /* malloc, free */ #include /* strcmp, strlen */ #include /* clock */ +#include /* errno */ #include "fileio.h" #include "zstd_static.h" @@ -299,9 +300,9 @@ unsigned long long FIO_compressFilename(const char* output_filename, const char* /* clean */ free(inBuff); free(outBuff); - fclose(finput); - fclose(foutput); ZSTD_freeCCtx(ctx); + fclose(finput); + if (fclose(foutput)) EXM_THROW(28, "Write error : cannot properly close output"); return compressedfilesize; }