aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Unix/Path.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/System/Unix/Path.inc')
-rw-r--r--lib/System/Unix/Path.inc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index 182a0bbd8c..c9333decbf 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -377,8 +377,10 @@ Path::create_file() {
if (!is_file()) return false;
// Create the file
- if (0 != creat(path.c_str(), S_IRUSR | S_IWUSR))
+ int fd = ::creat(path.c_str(), S_IRUSR | S_IWUSR);
+ if (fd < 0)
ThrowErrno(std::string(path.c_str()) + ": Can't create file");
+ ::close(fd);
return true;
}