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: 917064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=tls.msk.ru Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40pXjG2wJsz9s4b for ; Sun, 20 May 2018 16:55:13 +1000 (AEST) Received: from localhost ([::1]:45401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIFL-00082c-1A for incoming@patchwork.ozlabs.org; Sun, 20 May 2018 02:55:11 -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+incoming=patchwork.ozlabs.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(-) 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);