]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[programs] Don’t try to chmod a dst file if it can’t be opened 1644/head
authorMike Swanson <mikeonthecomputer@gmail.com>
Sun, 9 Jun 2019 08:52:45 +0000 (01:52 -0700)
committerMike Swanson <mikeonthecomputer@gmail.com>
Sun, 9 Jun 2019 08:52:45 +0000 (01:52 -0700)
Repairs an oversight in my last commit, thanks @Cyan4973

programs/fileio.c

index 12e1537e6c0329413ffb8b00d1bab6d7efdf2b6a..fba7115759140347f736944e1ff08d612a1c5066 100644 (file)
@@ -564,9 +564,11 @@ static FILE* FIO_openDstFile(FIO_prefs_t* const prefs, const char* srcFileName,
     }   }
 
     {   FILE* const f = fopen( dstFileName, "wb" );
-        if (f == NULL)
+        if (f == NULL) {
             DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno));
-        chmod(dstFileName, 00600);
+        } else {
+            chmod(dstFileName, 00600);
+        }
         return f;
     }
 }