From 5ff81d97c9f3c3cd189c5e387a252bcf5fbd38a7 Mon Sep 17 00:00:00 2001 From: venaas Date: Thu, 4 Jan 2007 14:43:53 +0000 Subject: fixed minor bugs git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@27 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util.c') diff --git a/util.c b/util.c index 4a2f1ad..7ca29c7 100644 --- a/util.c +++ b/util.c @@ -71,7 +71,7 @@ char *addr2string(struct sockaddr *addr, socklen_t len) { int bindport(int type, char *port) { struct addrinfo hints, *res0, *res; - int s; + int s, one = 1; memset(&hints, 0, sizeof(hints)); hints.ai_socktype = type; @@ -85,6 +85,7 @@ int bindport(int type, char *port) { for (res = res0; res; res = res->ai_next) { s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (s >= 0) { + setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); if (bind(s, res->ai_addr, res->ai_addrlen) == 0) break; close(s); -- cgit v1.2.3