Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions libc/src/fcntl/linux/creat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions libc/src/fcntl/linux/openat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading