Use stat() to Check that File Should be chmod()-ed
Rather than special-casing a check for `/dev/null`, this uses `stat()` to avoid `chmod()`-ing any non-regular file. I believe this is the desirable behavior. `UTIL_chmod()` is never called on directories at the moment, only output files.
This commit is contained in:
+2
-2
@@ -509,7 +509,7 @@ static int FIO_remove(const char* path)
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
/* windows doesn't allow remove read-only files,
|
||||
* so try to make it writable first */
|
||||
UTIL_chmod(path, _S_IWRITE);
|
||||
UTIL_chmod(path, NULL, _S_IWRITE);
|
||||
#endif
|
||||
return remove(path);
|
||||
}
|
||||
@@ -619,7 +619,7 @@ FIO_openDstFile(FIO_prefs_t* const prefs,
|
||||
&& strcmp (srcFileName, stdinmark)
|
||||
&& strcmp(dstFileName, nulmark) ) {
|
||||
/* reduce rights on newly created dst file while compression is ongoing */
|
||||
UTIL_chmod(dstFileName, 00600);
|
||||
UTIL_chmod(dstFileName, NULL, 00600);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user