summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/socket_wrapper.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index b43c877..9ba212b 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -3154,6 +3154,14 @@ static int swrap_listen(int s, int backlog)
return libc_listen(s, backlog);
}
+ if (si->bound == 0) {
+ ret = swrap_auto_bind(s, si, si->family);
+ if (ret == -1) {
+ errno = EADDRINUSE;
+ return ret;
+ }
+ }
+
ret = libc_listen(s, backlog);
return ret;