Commit b55669bf570339188461a9ba755c2386f549de90

Authored by pbrook
1 parent f5ba07d3

Set SO_REUSEADDR before calling bind().


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1783 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 1 additions and 1 deletions
slirp/socket.c
... ... @@ -573,6 +573,7 @@ solisten(port, laddr, lport, flags)
573 573 addr.sin_port = port;
574 574  
575 575 if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
  576 + (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
576 577 (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
577 578 (listen(s,1) < 0)) {
578 579 int tmperrno = errno; /* Don't clobber the real reason we failed */
... ... @@ -587,7 +588,6 @@ solisten(port, laddr, lport, flags)
587 588 #endif
588 589 return NULL;
589 590 }
590   - setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
591 591 setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
592 592  
593 593 getsockname(s,(struct sockaddr *)&addr,&addrlen);
... ...