From nobody Sun May 19 01:42:56 2024 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=1589438177; cv=none; d=zohomail.com; s=zohoarc; b=au34wuL0zRBIC6c0QxHfBLuhWxFqQj6QR1ZDyu6LbDgD2EWFrPGx0dmXuXF0AqcJlbE3HlyYjrtH/1ZtHdHnhi1v+Ol6UT95lKdidjaYzkuO+8SKieOdP8ME797S9bpKaseargsEN2GEtpmsx1JEtJ9fC3N+dhdhMB3F82Dly7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589438177; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uH2rg+6e+ESUF5koplQgjyyC/a1Sb01gbKnn/07/Xek=; b=JBiIatuGGPKxqoLblLhYd6QSj7+c9MsZmvzgIb3lMqNOZ5UibodFdxULjRcVkGA5Hl+BagPjsXaDCuk5GKKmZmZVr0Ui0yeiYlUFuQQM2vyEc3AY+7vdxafJnrSxIGR5bzpHNyd9EME9zlv5Ec1+vTplxmsNOF6b+cDAWtdAwPM= 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 158943817702518.43974669537431; Wed, 13 May 2020 23:36:17 -0700 (PDT) Received: from localhost ([::1]:45354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZ7Tb-0002MC-JU for importer@patchew.org; Thu, 14 May 2020 02:36:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ7PM-0004lf-VK; Thu, 14 May 2020 02:31:52 -0400 Received: from mail.hetzner.company ([2a01:4f8:d0a:203a::1]:50232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ7PL-0001SJ-LG; Thu, 14 May 2020 02:31:52 -0400 Received: from [2a01:4f8:0:a53b:fd81:523d:dd49:b8d4] (helo=hetzner.com) by mail.hetzner.company with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1jZ7PI-0000UC-Qo; Thu, 14 May 2020 08:31:48 +0200 From: Raphael Pour To: Eric Blake Subject: [PATCH v2 1/1] qemu-nbd: Close inherited stderr Date: Thu, 14 May 2020 08:31:12 +0200 Message-Id: <20200514063112.1457125-2-raphael.pour@hetzner.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200514063112.1457125-1-raphael.pour@hetzner.com> References: <1jYr2L-0004mc-Jj@mail.hetzner.company> <20200514063112.1457125-1-raphael.pour@hetzner.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 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: Raphael Pour , qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Close inherited stderr of the parent if fork_process is false. Otherwise no one will close it. (introduced by e6df58a5) --- qemu-nbd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index 4aa005004e..a324d21c5e 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -916,7 +916,13 @@ int main(int argc, char **argv) } else if (pid =3D=3D 0) { close(stderr_fd[0]); =20 - old_stderr =3D dup(STDERR_FILENO); + /* Remember parents stderr only if the fork option is set. + * The child won't close this inherited fd otherwise. + */ + if (fork_process) { + old_stderr =3D dup(STDERR_FILENO); + } + ret =3D qemu_daemon(1, 0); =20 /* Temporarily redirect stderr to the parent's pipe... */ --=20 2.25.4