diff --git a/src/os/portable/os-impl-posix-files.c b/src/os/portable/os-impl-posix-files.c index 43628d5df..7f33f41cc 100644 --- a/src/os/portable/os-impl-posix-files.c +++ b/src/os/portable/os-impl-posix-files.c @@ -198,11 +198,15 @@ int32 OS_FileChmod_Impl(const char *local_path, uint32 access) struct stat st; int fd; - /* Open file to avoid filename race potential */ + /* Open file to avoid filename race potential */ fd = open(local_path, O_RDONLY); if (fd < 0) { - return OS_ERROR; + fd = open(local_path, O_WRONLY); + if (fd < 0) + { + return OS_ERROR; + } } /*