From 8b4991b2dbd5eb4e8178276a2281e8a6cfca5f7e Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Mon, 17 Oct 2022 14:13:58 -0400 Subject: [PATCH] F_SETFD should always return 0 on success --- libc/calls/fcntl-nt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/calls/fcntl-nt.c b/libc/calls/fcntl-nt.c index 491388499..20c94be4e 100644 --- a/libc/calls/fcntl-nt.c +++ b/libc/calls/fcntl-nt.c @@ -150,11 +150,10 @@ textwindows int sys_fcntl_nt(int fd, int cmd, uintptr_t arg) { } else if (cmd == F_SETFD) { if (arg & FD_CLOEXEC) { g_fds.p[fd].flags |= O_CLOEXEC; - return FD_CLOEXEC; } else { g_fds.p[fd].flags &= ~O_CLOEXEC; - return 0; } + return 0; } else if (cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK) { return sys_fcntl_nt_lock(g_fds.p + fd, cmd, arg); } else if (cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC) {