From: Bodo Möller Date: Fri, 2 Apr 1999 23:35:43 +0000 (+0000) Subject: Avoid EADDRINUSE for s_server. X-Git-Tag: OpenSSL_0_9_3beta1~376 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cf897932ca13b46b71de1d509ca7b262b718a464;p=oweals%2Fopenssl.git Avoid EADDRINUSE for s_server. Submitted by: Reviewed by: PR: --- diff --git a/apps/s_socket.c b/apps/s_socket.c index 6274acf53b..0030b57936 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -342,6 +342,12 @@ char *ip; s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); if (s == INVALID_SOCKET) goto err; +#if defined SOL_SOCKET && defined SO_REUSEADDR + { + int i = 1; + setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &i, sizeof i); + } +#endif if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1) { #ifndef WINDOWS