From nobody Fri Nov 14 16:50:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1589273980; cv=none; d=zohomail.com; s=zohoarc; b=him7sQyESDx5DQthlAAmfK03avO/cX1ao2eCTv5RR8+iVKKx7+ZI8kKNqEdhQIneQSvPCKy67jPj6/Rtx70IxjkF1+bf9jd1KKBwN1F8nvRM81NosoIbSdSJTLx0MIw1XYy+au/1tm8CKXgi5BHdcUsLm7Y0hO7m16ZERTrRRog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589273980; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ANVUUP9chi3yIWzWaUFIXd2qWVfy/29alGMzVlRn1Jc=; b=Rb/uixPJPdeoODukvKpdrDu+lL8/UhrUA/uwLN4hvcyqQXbeEPQ7DjW7j++CNnTcJPBqMIve4OafkcsbR0EpazYHZsKw06ed2+PZuXg98/83DMEpjuEMHWAHCZ0GWW6IIRAVZlo3iVHXJQ/mpnqNFkA9GkopgUbz6N6GbFEGASU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589273980468496.68843702232664; Tue, 12 May 2020 01:59:40 -0700 (PDT) Received: from localhost ([::1]:40144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYQlH-0000dN-3b for importer@patchew.org; Tue, 12 May 2020 04:59:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYQis-0005BT-Dw; Tue, 12 May 2020 04:57:10 -0400 Received: from mail.hetzner.company ([2a01:4f8:d0a:203a::1]:39392) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYQip-0004Xs-37; Tue, 12 May 2020 04:57:08 -0400 Received: from [88.198.139.25] (helo=[10.17.32.77]) by mail.hetzner.company with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1jYQih-0008VZ-5I; Tue, 12 May 2020 10:56:59 +0200 From: Raphael Pour Autocrypt: addr=raphael.pour@hetzner.com; keydata= mDMEXmXjyxYJKwYBBAHaRw8BAQdAtiEYnlLIuIUjvvqOH//nEbhrxSa54ZyAl7Iel403QaW0 J1JhcGhhZWwgUG91ciA8cmFwaGFlbC5wb3VyQGhldHpuZXIuY29tPoiWBBMWCAA+FiEEvj4O DnHb6pxm/uWJzbHrt4XF634FAl5l48sCGwMFCQlmAYAFCwkIBwIGFQoJCAsCBBYCAwECHgEC F4AACgkQzbHrt4XF635TcwD+NEMqL1HZPHP/WRsYujCDtqt0p+7uxGcpvzv//AjqMZ0A+wUh 0bOYYNdlXWNMMNLA88SsAT2mxAfD+F/paVmLpdoLuDgEXmXjyxIKKwYBBAGXVQEFAQEHQB0z JYP6jtTj989IJL1vguinsiIxia5fkW83OB1+Bb4QAwEIB4h+BBgWCAAmFiEEvj4ODnHb6pxm /uWJzbHrt4XF634FAl5l48sCGwwFCQlmAYAACgkQzbHrt4XF6372LgEAi3qfceU+R53Ehg/Y SSHV4wg+zfPwrD6ylEg/xKabYDcBALrD0E3YX458RPjLIOC8H0u0rcFIvBqNYx/kGaMEmbEG To: qemu-devel@nongnu.org Subject: [PATCH] qemu-nbd: Close inherited stderr Message-ID: Date: Tue, 12 May 2020 10:56:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iIW4pD4LD2mH6V1RCfQvjB97TZmSo54io" X-Authenticated-Sender: raphael.pour@hetzner.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:4f8:d0a:203a::1; envelope-from=raphael.pour@hetzner.com; helo=mail.hetzner.company X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-Zoho-Virus-Status: 1 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iIW4pD4LD2mH6V1RCfQvjB97TZmSo54io Content-Type: multipart/mixed; boundary="HYWvrtjcfB1Q8MJlYLuDvgyeGulioOZqu" --HYWvrtjcfB1Q8MJlYLuDvgyeGulioOZqu Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hello, after e6df58a5, the inherited stderr 'old_stderr' won't get closed anymore if 'fork_process' is false. This causes other processes relying on EOF to infinitely block or crash. =46rom 47ab9b517038d13117876a8bb3ef45c53d7f2f9e Mon Sep 17 00:00:00 2001 From: "Raphael Pour" Date: Tue, 12 May 2020 10:18:44 +0200 Subject: [PATCH] qemu-nbd: Close inherited stderr Close inherited stderr of the parent if fork_process is false. Otherwise no one will close it. (introduced by e6df58a5) Signed-off-by: Raphael Pour --- qemu-nbd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index 108a51f7e..f2981e18a 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -1032,8 +1032,15 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - /* ... close the descriptor we inherited and go on. */ + /* ... close the descriptor we inherited and ... */ close(stderr_fd[1]); + + /* ... also close the old_stderr IF fork_process is false otherwise + * it will never get closed. + */ + if (!fork_process) { + close(old_stderr); + } } else { bool errors =3D false; char *buf; --=20 2.25.4 --=20 Hetzner Online GmbH Am Datacenter-Park 1 08223 Falkenstein/Vogtland raphael.pour@hetzner.com www.hetzner.com Registergericht Ansbach, HRB 6089 Gesch=C3=A4ftsf=C3=BChrer: Martin Hetzner, Stephan Konvickova, G=C3=BCnth= er M=C3=BCller --HYWvrtjcfB1Q8MJlYLuDvgyeGulioOZqu-- --iIW4pD4LD2mH6V1RCfQvjB97TZmSo54io Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQS+Pg4OcdvqnGb+5YnNseu3hcXrfgUCXrpk1wAKCRDNseu3hcXr flJ1AQCEJ/CtW3roS8iS6IRRZb8CzuivK7REbVTEG6SkjrrcXwEAnWs1qZ0nqK5x 0LQYcCyT1jEM7oMuY4K5/sB8XbpKmQA= =Hm17 -----END PGP SIGNATURE----- --iIW4pD4LD2mH6V1RCfQvjB97TZmSo54io--