Commit fde2d231 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make it a failure to not get all acceptor sockets on child start.

parent 00ce8fcf
......@@ -33,7 +33,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -58,26 +58,23 @@ int
MAC_open_sockets(void)
{
struct listen_sock *ls;
int good = 0;
int fail;
VJ_master(JAIL_MASTER_PRIVPORT);
VTAILQ_FOREACH(ls, &heritage.socks, list) {
if (ls->sock >= 0) {
good++;
continue;
}
assert(ls->sock < 0);
ls->sock = VTCP_bind(ls->addr, NULL);
if (ls->sock < 0)
continue;
break;
mgt_child_inherit(ls->sock, "sock");
good++;
}
fail = errno;
VJ_master(JAIL_MASTER_LOW);
if (!good)
return (1);
return (0);
if (ls == NULL)
return (0);
MAC_close_sockets();
errno = fail;
return (-1);
}
/*--------------------------------------------------------------------*/
......@@ -158,7 +155,7 @@ MAC_Arg(const char *arg)
mh->err = &err;
error = VSS_resolver(av[1], "80", mac_callback, mh, &err);
if (mh->good == 0 || err != NULL)
ARGV_ERR("Could not open %s: %s\n", av[1], err);
ARGV_ERR("Could not bind to address %s: %s\n", av[1], err);
AZ(error);
FREE_OBJ(mh);
}
......@@ -4,7 +4,7 @@ varnishtest "Check that we fail to start if any listen address does not work"
# and are on Linux, ensure /proc/net/ipv4/ip_nonlocal_bind is set to 0.
# All bad listen addresses
err_shell "Could not open 192.0.2.255:0" {${varnishd} -F -a "${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 }
err_shell "Could not bind to address 192.0.2.255:0" {${varnishd} -F -a "${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 }
# Just one bad listen addresses
err_shell "Error: XXX: not yet" {${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment