aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-05-14 18:30:43 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2018-05-20 08:55:54 +0300
commitf5bdd781316d2ba140323cb98392e44cac54017d (patch)
treeca78244d68e2b82b637c30fb9023b1a39b896e66 /gdbstub.c
parentd29eb678bcfbb2fbf4b79423797253ee02f5c6cf (diff)
gdbstub: Use qemu_set_cloexec()
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 <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c8
1 files 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);