[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd |
Date: |
Sat, 29 Apr 2023 16:57:47 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Sergey Bugaev, le sam. 29 avril 2023 16:13:53 +0300, a ecrit:
> If the process has set the close-on-exec flag for the file descriptor,
> it expects the file descriptor to get closed on exec, even if we replace
> what the file descriptor refers to.
>
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
> hurd/hurdmsg.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hurd/hurdmsg.c b/hurd/hurdmsg.c
> index 896fb87c..8fde1f53 100644
> --- a/hurd/hurdmsg.c
> +++ b/hurd/hurdmsg.c
> @@ -323,7 +323,13 @@ _S_msg_set_fd (mach_port_t msgport, mach_port_t auth,
> AUTHCHECK;
>
> /* We consume the reference if successful. */
> - err = HURD_FD_USE (which, (_hurd_port2fd (descriptor, port, 0), 0));
> + err = HURD_FD_USE (which,
> + ({
> + int flags = (descriptor->flags & FD_CLOEXEC)
> + ? O_CLOEXEC : 0;
> + _hurd_port2fd (descriptor, port, flags);
> + 0;
> + }));
> if (err)
> return err;
>
> --
> 2.40.1
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit, Sergey Bugaev, 2023/04/29
- [PATCH 2/7] hurd: Move libc_hidden_def's around, Sergey Bugaev, 2023/04/29
- [PATCH 3/7] hurd: Mark various conditions as unlikely, Sergey Bugaev, 2023/04/29
- [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd, Sergey Bugaev, 2023/04/29
- Re: [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd,
Samuel Thibault <=
- [PATCH 4/7] hurd: Make _exit work during early boot-up, Sergey Bugaev, 2023/04/29
- [PATCH 5/7] hurd: Don't leak the auth port in msg* RPCs, Sergey Bugaev, 2023/04/29
- [PATCH 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling, Sergey Bugaev, 2023/04/29
- Re: [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit, Samuel Thibault, 2023/04/29