From: Mike Swanson Date: Sun, 9 Jun 2019 08:52:45 +0000 (-0700) Subject: [programs] Don’t try to chmod a dst file if it can’t be opened X-Git-Tag: v1.4.1^2~26^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af80f6dfacafcc2c916ecd57731107221e1f9986;p=thirdparty%2Fzstd.git [programs] Don’t try to chmod a dst file if it can’t be opened Repairs an oversight in my last commit, thanks @Cyan4973 --- diff --git a/programs/fileio.c b/programs/fileio.c index 12e1537e6..fba711575 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -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; } }