aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix
diff options
context:
space:
mode:
authorBastien Bouclet2016-08-30 20:35:02 +0200
committerBastien Bouclet2016-08-30 21:19:59 +0200
commitb00cb955d9eda9829aee00ac548389f555cab29e (patch)
treea7bc2420586f26c8f74201bbfee17cdb1dc8116d /backends/fs/posix
parentdac70196f08650dc90837a7d4d68b7e9d115345d (diff)
downloadscummvm-rg350-b00cb955d9eda9829aee00ac548389f555cab29e.tar.gz
scummvm-rg350-b00cb955d9eda9829aee00ac548389f555cab29e.tar.bz2
scummvm-rg350-b00cb955d9eda9829aee00ac548389f555cab29e.zip
BACKENDS: Use open instead of creat to create files
creat is not defined on the PS3. Also close the file descriptor.
Diffstat (limited to 'backends/fs/posix')
-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) {