From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 238C13858C2B for ; Sat, 29 Apr 2023 14:57:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 238C13858C2B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psm1E-0000zb-Gs; Sat, 29 Apr 2023 10:57:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=0vaoWtW4anWOG2ts6PBYmQ9cipyMabK3pzOFGijYwN8=; b=BH9434F98XGTAVfCmqp7 eG9Ot9Q6CjPbcy/PZTW4s/lYjwShTcwgR8fE8eXFDLXtg3cxy5nbaoE4GTqV7wG3nc1yUatkAJmHB 4+yZlhUQbE4qYHU/ZnPmp8j58ty46fNkxnLz0l4SgbUHGntjPESu27jti5ayLi0WS8fVaKscSCVaL IDDN5xRT57dAMPX7pIrXWWpHu5l/Kxnmg/TT96+uvMOsxuOGKz+fh/FnWLAnF8mezywJV+AVucVtf gryOB22jT95Cu7uQLUlykVxUm5LL0KfE+ekmhQ0U9GH0QdhhXDdtgScrinvkpp773czBzS3EFV7cA 10/n4TsIoJ/O7A==; Received: from [2a01:cb19:4a:a400:de41:a9ff:fe47:ec49] (helo=begin.home) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psm1E-00033q-6G; Sat, 29 Apr 2023 10:57:48 -0400 Received: from samy by begin.home with local (Exim 4.96) (envelope-from ) id 1psm1D-002Ebf-0N; Sat, 29 Apr 2023 16:57:47 +0200 Date: Sat, 29 Apr 2023 16:57:47 +0200 From: Samuel Thibault To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd Message-ID: <20230429145747.hqagqfvrevb6ti7x@begin> Mail-Followup-To: Sergey Bugaev , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20230429131354.2507443-1-bugaevc@gmail.com> <20230429131354.2507443-6-bugaevc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230429131354.2507443-6-bugaevc@gmail.com> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 > --- > 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.