aboutsummaryrefslogtreecommitdiff
path: root/slirp/socket.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-03-11 20:48:36 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-03-11 20:48:36 +0000
commitb55669bf570339188461a9ba755c2386f549de90 (patch)
tree78dde0b390cb2275ee9123a1a83f69f3fa502916 /slirp/socket.c
parentf5ba07d399ff205da3e91de4389e936027856b48 (diff)
Set SO_REUSEADDR before calling bind().
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1783 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/socket.c')
-rw-r--r--slirp/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/slirp/socket.c b/slirp/socket.c
index 47ed44b937..fbd9e960d7 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -573,6 +573,7 @@ solisten(port, laddr, lport, flags)
addr.sin_port = port;
if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
+ (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
(bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
(listen(s,1) < 0)) {
int tmperrno = errno; /* Don't clobber the real reason we failed */
@@ -587,7 +588,6 @@ solisten(port, laddr, lport, flags)
#endif
return NULL;
}
- setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
getsockname(s,(struct sockaddr *)&addr,&addrlen);