aboutsummaryrefslogtreecommitdiff
path: root/libc/src/fcntl/linux/openat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/fcntl/linux/openat.cpp')
-rw-r--r--libc/src/fcntl/linux/openat.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libc/src/fcntl/linux/openat.cpp b/libc/src/fcntl/linux/openat.cpp
index b47ad1f..b80abe5 100644
--- a/libc/src/fcntl/linux/openat.cpp
+++ b/libc/src/fcntl/linux/openat.cpp
@@ -32,11 +32,11 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) {
int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, dfd, path, flags,
mode_flags);
- if (fd > 0)
- return fd;
-
- libc_errno = -fd;
- return -1;
+ if (fd < 0) {
+ libc_errno = -fd;
+ return -1;
+ }
+ return fd;
}
} // namespace LIBC_NAMESPACE_DECL