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 <[email protected]>
This commit is contained in:
Jérôme Duval
2019-03-30 15:19:51 +00:00
committed by waddlesplash
parent 532998ed1e
commit 03ed26b691
+1 -1
View File
@@ -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);