diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index e9c7e95cc3..4ac9022711 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -6226,7 +6226,7 @@ common_fcntl(int fd, int op, size_t argument, bool kernel) status = new_fd_etc(context, descriptor, (int)argument); if (status >= 0) { mutex_lock(&context->io_mutex); - fd_set_close_on_exec(context, fd, op == F_DUPFD_CLOEXEC); + fd_set_close_on_exec(context, status, op == F_DUPFD_CLOEXEC); mutex_unlock(&context->io_mutex); atomic_add(&descriptor->ref_count, 1);