summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorvenaas <venaas>2007-01-04 14:43:53 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-01-04 14:43:53 +0000
commit5ff81d97c9f3c3cd189c5e387a252bcf5fbd38a7 (patch)
tree5adc53e74f52aac376b0aee3ac93516723a6b129 /util.c
parent28699bc5e546f880b466e392659c927456e40820 (diff)
fixed minor bugs
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@27 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'util.c')
-rw-r--r--util.c3
1 files changed, 2 insertions, 1 deletions
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);