From patchwork Sun May 20 06:15:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 136413 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3157620lji; Sat, 19 May 2018 23:57:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpVcIRd6pHWOUHBMKZYpPDp4JBYSzXUsvM5wEq2KBRKkGDY2F/7w5Q7cqbYEuKSWQ5bgz2+ X-Received: by 2002:a0c:dc0c:: with SMTP id s12-v6mr14305132qvk.130.1526799443511; Sat, 19 May 2018 23:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526799443; cv=none; d=google.com; s=arc-20160816; b=GlydPI+xrhkZnlx0md19UWmLrQOVF/X1V8ESnvxfsL58Lcf+8CAMRmrzoz44fp3end cX2hpaCh7UXnPqBemfwet2+p/PRJaq7ToBxE2zpXNlJH6Ec6GTr2LeQ/vd8RXbm9gq05 lX6TfPpRO4P838sUjcG8dxLFRIoxs2u0j0Uc6jpINXWryWhokW4Zuuk3TWmiQncNq/9K 4+PdBaP/UwFS+A0wqzuMhYJVYmbA95jyvJozQO+YsP3yBpUrq5sGGnBs8AI0A5Pz7XS2 na42KfGSgrg4UBvlc0niU2Jk+K2E1QyNWD9ULZl8+XUCEVRtoo5mKhbPygm03Plxspej qBKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=53ymkacw1nI9Vn2qIyvaE69qg03xkB7peyiEMBy6Qx4=; b=b9dc4WF/CVtQZ5PR2D/I+Dr36HAMkQNTxdzcDSeITATg62T4Fg44PRmUt56lF9S7v8 fSllFZUB7ZYKYBssBmuDp33hCmOAi22BQsE65tzOL17u4IaA/xGE7IxM+5ycAsOO+Iej GBUBwl1SOn3dVdl5ew1xguNWIdd/LjvREyf/A1+44uXCv8V+4cXT/zTfri+qXtwzWol+ GPJM2zhT8iHorMuqDPjsP6o8euid1xXwoQCvIXZ8aaec7FL2rpYLagR/Y/t51C5fev+4 4CDyVX93FJdcy8jptz7JnuVQDwb2dZGVPvH5lodP3tAPTaQ10TxkRBQX1ewirbJsZz3+ tUXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q46-v6si3873509qtb.16.2018.05.19.23.57.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 19 May 2018 23:57:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:45409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIHS-0001ME-Us for patch@linaro.org; Sun, 20 May 2018 02:57:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIEY-0007pH-KG for qemu-devel@nongnu.org; Sun, 20 May 2018 02:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKIEV-0002KB-JH for qemu-devel@nongnu.org; Sun, 20 May 2018 02:54:22 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:60971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIEV-0002Je-BB; Sun, 20 May 2018 02:54:19 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 4A66E4112D; Sun, 20 May 2018 09:54:18 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 1F9C310CD; Sun, 20 May 2018 09:15:14 +0300 (MSK) Received: (nullmailer pid 7410 invoked by uid 1000); Sun, 20 May 2018 06:15:12 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Sun, 20 May 2018 09:15:05 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 19/22] 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: qemu-trivial@nongnu.org, Peter Maydell , Michael Tokarev Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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é Reviewed-by: Thomas Huth Signed-off-by: Michael Tokarev --- gdbstub.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) -- 2.11.0 diff --git a/gdbstub.c b/gdbstub.c index 9682e16ef7..b99980d2e2 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1828,9 +1828,7 @@ static void gdb_accept(void) perror("accept"); return; } else if (fd >= 0) { -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif + qemu_set_cloexec(fd); break; } } @@ -1857,9 +1855,7 @@ static int gdbserver_open(int port) perror("socket"); return -1; } -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif + qemu_set_cloexec(fd); socket_set_fast_reuse(fd);