diff options
Diffstat (limited to 'libc/src/fcntl/linux/creat.cpp')
| -rw-r--r-- | libc/src/fcntl/linux/creat.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libc/src/fcntl/linux/creat.cpp b/libc/src/fcntl/linux/creat.cpp index 71412a8e..e74cef2 100644 --- a/libc/src/fcntl/linux/creat.cpp +++ b/libc/src/fcntl/linux/creat.cpp @@ -27,11 +27,11 @@ LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) { SYS_openat, AT_FDCWD, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); #endif - if (fd > 0) - return fd; - - libc_errno = -fd; - return -1; + if (fd < 0) { + libc_errno = -fd; + return -1; + } + return fd; } } // namespace LIBC_NAMESPACE_DECL |
