]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fixed #42
authorYann Collet <yann.collet.73@gmail.com>
Tue, 25 Aug 2015 16:41:46 +0000 (17:41 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Tue, 25 Aug 2015 16:41:46 +0000 (17:41 +0100)
programs/Makefile
programs/fileio.c

index b90cfdcef35628cfb03f84023a70ca0bf058df60..525832453fa68cbad3d9adcac0e7cd8f617c96e4 100644 (file)
@@ -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)
index d1c4a7c7f06548b0bb1019ba8b94ff6a5b228230..82fce992e914dd505a6354b51524b43bef877b9e 100644 (file)
@@ -52,6 +52,7 @@
 #include <stdlib.h>   /* malloc, free */
 #include <string.h>   /* strcmp, strlen */
 #include <time.h>     /* clock */
+#include <errno.h>    /* 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;
 }