summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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);