From nobody Sat Nov 1 08:17:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526319284976550.7105760624269; Mon, 14 May 2018 10:34:44 -0700 (PDT) Received: from localhost ([::1]:47454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIHMt-0000pg-7W for importer@patchew.org; Mon, 14 May 2018 13:34:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIHJJ-0007AD-1N for qemu-devel@nongnu.org; Mon, 14 May 2018 13:30:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIHJI-00066v-8F for qemu-devel@nongnu.org; Mon, 14 May 2018 13:30:57 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:41642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fIHJI-0005yO-1U; Mon, 14 May 2018 13:30:56 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fIHJ8-0000I7-E3; Mon, 14 May 2018 18:30:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Date: Mon, 14 May 2018 18:30:43 +0100 Message-Id: <20180514173044.5025-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514173044.5025-1-peter.maydell@linaro.org> References: <20180514173044.5025-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 1/2] gdbstub: Use qemu_set_cloexec() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the utility routine qemu_set_cloexec() rather than manually calling fcntl(). This lets us drop the #ifndef _WIN32 guards and also means Coverity doesn't complain that we're ignoring the fcntl error return (CID 1005665, CID 1005667). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- gdbstub.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 3c3807358c..cc7626c790 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1818,9 +1818,7 @@ static void gdb_accept(void) perror("accept"); return; } else if (fd >=3D 0) { -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif + qemu_set_cloexec(fd); break; } } @@ -1847,9 +1845,7 @@ static int gdbserver_open(int port) perror("socket"); return -1; } -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif + qemu_set_cloexec(fd); =20 socket_set_fast_reuse(fd); =20 --=20 2.17.0