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 <pulkomandy@gmail.com>
This commit is contained in:
Jérôme Duval 2019-03-29 23:52:01 +01:00 committed by waddlesplash
parent 532998ed1e
commit 03ed26b691
1 changed files with 1 additions and 1 deletions

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); status = new_fd_etc(context, descriptor, (int)argument);
if (status >= 0) { if (status >= 0) {
mutex_lock(&context->io_mutex); 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); mutex_unlock(&context->io_mutex);
atomic_add(&descriptor->ref_count, 1); atomic_add(&descriptor->ref_count, 1);