From 03ed26b691911a83768b6b2f98a9ad2d16a8b912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 29 Mar 2019 23:52:01 +0100 Subject: [PATCH] kernel/fs/vfs: apply CLOEXEC on the new fd instead of the old one. fix a failure for test-cloexec.c of gltests. Change-Id: I340cc88a787a59d55f93cc80883f57e6627f38cf Reviewed-on: https://review.haiku-os.org/c/1332 Reviewed-by: Adrien Destugues --- src/system/kernel/fs/vfs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);