git.samba.org
/
obnox
/
cwrap
/
socket_wrapper.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f24f91e
)
swrap: Automatically bind an ephemeral port if needed
author
Andreas Schneider
<asn@samba.org>
Wed, 4 Nov 2015 10:21:23 +0000
(11:21 +0100)
committer
Andreas Schneider
<asn@samba.org>
Wed, 4 Nov 2015 14:11:20 +0000
(15:11 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
src/socket_wrapper.c
patch
|
blob
|
history
diff --git
a/src/socket_wrapper.c
b/src/socket_wrapper.c
index b43c877d0a8e8ac84e746846d4bc3cbb241b7575..9ba212bafe41ea7a9d0ba431407f2cf36347638c 100644
(file)
--- 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;