]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
updated error checking in each thread
authorPaul Cruz <paulcruz74@fb.com>
Mon, 10 Jul 2017 16:36:22 +0000 (09:36 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Mon, 10 Jul 2017 16:36:22 +0000 (09:36 -0700)
contrib/adaptive-compression/multi.c

index 78d9ca154fc988bac9b2bab62d5c5caa1609e30e..4c3f584e12f1bad926452a76e53e1b1772f6aa60 100644 (file)
@@ -284,12 +284,14 @@ static void* outputThread(void* arg)
             size_t const compressedSize = job->compressedSize;
             if (ZSTD_isError(compressedSize)) {
                 DISPLAY("Error: an error occurred during compression\n");
+                ctx->threadError = 1;
                 return arg;
             }
             {
                 size_t const writeSize = fwrite(job->dst.start, 1, compressedSize, ctx->dstFile);
                 if (writeSize != compressedSize) {
                     DISPLAY("Error: an error occurred during file write operation\n");
+                    ctx->threadError = 1;
                     return arg;
                 }
             }
@@ -429,6 +431,7 @@ static int compressFilename(const char* const srcFilename, const char* const dst
         size_t const readSize = fread(src, 1, FILE_CHUNK_SIZE, srcFile);
         if (readSize != FILE_CHUNK_SIZE && !feof(srcFile)) {
             DISPLAY("Error: problem occurred during read from src file\n");
+            ctx->threadError = 1;
             ret = 1;
             goto cleanup;
         }
@@ -438,6 +441,7 @@ static int compressFilename(const char* const srcFilename, const char* const dst
             int const error = createCompressionJob(ctx, src, readSize);
             if (error != 0) {
                 ret = error;
+                ctx->threadError = 1;
                 goto cleanup;
             }
         }