From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 733C53857C44 for ; Sat, 29 Apr 2023 13:14:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 733C53857C44 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4f004943558so1120599e87.3 for ; Sat, 29 Apr 2023 06:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682774041; x=1685366041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3dATLxkH3GnzLr0ArZjgS5VyRTP+KiINtCGUzZNmMOI=; b=lvSydHE0GL8BV5VNIbdnr6suvrvEV0YA+7t/XhuKYdkUuHqSUcpNx6dc1o2xxqNEgu +IPg6+AVdwGrBWKXjsJ4MJ0UvOk2P4SYwxEtLZz4ZOoUvLqacT4fT+teP5E/Ogy0kG93 /dHYXiQkeXq5KcF4Cj3btniwK8/E/lfstd9xcJi2+WC1jtP3iGPlaIqRe5jFXwkHbLE4 ql+2+XrDM8tQlNmcjqCr/qvZjemxvrX9CZdceuyUQJIGyCQw6IEAoMXYvGp1JvbKhMl4 x91DdHGCh90ZT2bGBFrbkr6eHJp+UGpKg51/F2yBAtRNLZLATHgEWTcIalOyO2I2/dKY P05Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682774041; x=1685366041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3dATLxkH3GnzLr0ArZjgS5VyRTP+KiINtCGUzZNmMOI=; b=IvmBWS0AuWxksZKl0RL4LKzuf2IVzsfIUxZmtu3wHvB+hirVjQ6dy0veaY9M7sXGJ0 F6R2myyO3NPpdoQn3v4Hf9TDXGLGpoxEJec3ag5XazysWLB08jBSBeJb3L0ZKrUrt6IH Q4Zjnbz3Z87d9OunVv+kl0l0DqQnQlVnaU8r8iq/Yf6y79+CD+OoTjq55jl70rQmcm9o camCaRooRDrRj+5FpPbklsmFNl8yp38M1eoJyTm/dNEHMBoEmnZ9z3Ff/Rbvemyq0lyI 2XLwSVO8FAhFi8o3FlHtiRIBnTuh5Epu69gfe3Q/b8edayY7POtmxcQXtiQig8Rvqtg9 pkVw== X-Gm-Message-State: AC+VfDxWssAqCdEeTxO2ha9U+foB0LgDVaFoudZu7inybMJ4DcovE4Lg bj9UJ5X/pHt7/Jh4GMWgqslfwnDQqS5nuw== X-Google-Smtp-Source: ACHHUZ5v/nsgJ0GdqinICxqA/DFMZLxoV7qmPLRztSoMF1qX5/6GGMfcpM9R2fp56DMpaHz3t/agTQ== X-Received: by 2002:a19:f814:0:b0:4e8:3fca:4927 with SMTP id a20-20020a19f814000000b004e83fca4927mr2277786lff.58.1682774040735; Sat, 29 Apr 2023 06:14:00 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:8a14:19ba:9e6b:1866]) by smtp.gmail.com with ESMTPSA id f27-20020ac251bb000000b004eb018fac57sm3744851lfk.191.2023.04.29.06.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Apr 2023 06:14:00 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org Cc: bug-hurd@gnu.org, Samuel Thibault Subject: [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd Date: Sat, 29 Apr 2023 16:13:53 +0300 Message-Id: <20230429131354.2507443-6-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230429131354.2507443-1-bugaevc@gmail.com> References: <20230429131354.2507443-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: 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