(mini_inetd): count sockets properly. and fail if we cannot bind any

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7827 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-01-26 00:52:04 +00:00
parent a4a6bd5732
commit bf23cfaf7e

View File

@@ -116,7 +116,7 @@ mini_inetd (int port)
FD_ZERO(&orig_read_set);
for (i = 0, a = ai; a != NULL; a = a->ai_next, ++i) {
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 (1, "socket");
@@ -129,8 +129,11 @@ mini_inetd (int port)
err (1, "listen");
FD_SET(fds[i], &orig_read_set);
max_fd = max(max_fd, fds[i]);
++i;
}
freeaddrinfo (ai);
if (i == 0)
errx (1, "no sockets");
do {
read_set = orig_read_set;