aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix/posix-fs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/fs/posix/posix-fs.cpp')
-rw-r--r--backends/fs/posix/posix-fs.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index b38a07637c..8597158f4c 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -259,7 +259,12 @@ bool POSIXFilesystemNode::create(bool isDirectory) {
if (isDirectory) {
success = mkdir(_path.c_str(), 0755) == 0;
} else {
- success = creat(_path.c_str(), 0755) != -1;
+ int fd = open(_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0755);
+ success = fd >= 0;
+
+ if (fd >= 0) {
+ close(fd);
+ }
}
if (success) {