summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/roken/mini_inetd.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/roken/mini_inetd.c')
-rw-r--r--crypto/heimdal/lib/roken/mini_inetd.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/crypto/heimdal/lib/roken/mini_inetd.c b/crypto/heimdal/lib/roken/mini_inetd.c
index bb31962..39dd046 100644
--- a/crypto/heimdal/lib/roken/mini_inetd.c
+++ b/crypto/heimdal/lib/roken/mini_inetd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: mini_inetd.c,v 1.28 2000/10/08 13:38:47 assar Exp $");
+RCSID("$Id: mini_inetd.c,v 1.29 2001/08/01 14:48:54 assar Exp $");
#endif
#include <err.h>
@@ -76,6 +76,7 @@ mini_inetd (int port)
memset (&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
+ hints.ai_family = PF_UNSPEC;
snprintf (portstr, sizeof(portstr), "%d", ntohs(port));
@@ -95,14 +96,20 @@ mini_inetd (int port)
for (i = 0, a = ai; a != NULL; a = a->ai_next) {
fds[i] = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
if (fds[i] < 0) {
- warn ("socket");
+ warn ("socket af = %d", a->ai_family);
continue;
}
socket_set_reuseaddr (fds[i], 1);
- if (bind (fds[i], a->ai_addr, a->ai_addrlen) < 0)
- err (1, "bind");
- if (listen (fds[i], SOMAXCONN) < 0)
- err (1, "listen");
+ if (bind (fds[i], a->ai_addr, a->ai_addrlen) < 0) {
+ warn ("bind af = %d", a->ai_family);
+ close(fds[i]);
+ continue;
+ }
+ if (listen (fds[i], SOMAXCONN) < 0) {
+ warn ("listen af = %d", a->ai_family);
+ close(fds[i]);
+ continue;
+ }
if (fds[i] >= FD_SETSIZE)
errx (1, "fd too large");
FD_SET(fds[i], &orig_read_set);
OpenPOWER on IntegriCloud