From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Peter Maydell Date: Mon, 14 May 2018 18:30:43 +0100 Message-Id: <20180514173044.5025-2-peter.maydell@linaro.org> In-Reply-To: <20180514173044.5025-1-peter.maydell@linaro.org> References: <20180514173044.5025-1-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 1/2] gdbstub: Use qemu_set_cloexec() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: patches@linaro.org 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 --- 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 >= 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); socket_set_fast_reuse(fd); -- 2.17.0