aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slirp/socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/slirp/socket.c b/slirp/socket.c
index 6c18971368..86927722e1 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -713,7 +713,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
(listen(s,1) < 0)) {
int tmperrno = errno; /* Don't clobber the real reason we failed */
- close(s);
+ if (s >= 0) {
+ closesocket(s);
+ }
sofree(so);
/* Restore the real errno */
#ifdef _WIN32