r3473 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Thu Dec 18 13:00:43 CET 2008
Author: phk
Date: 2008-12-18 13:00:43 +0100 (Thu, 18 Dec 2008)
New Revision: 3473
Modified:
trunk/varnish-cache/bin/varnishd/mgt_cli.c
Log:
Only fail -T argument if none of the addresses it resolves to
can be listend on.
Fixes #97
Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-12-18 11:48:56 UTC (rev 3472)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-12-18 12:00:43 UTC (rev 3473)
@@ -459,22 +459,23 @@
{
struct vss_addr **ta;
char *addr, *port;
- int i, n, sock;
+ int i, n, sock, good;
struct telnet *tn;
dflag_copy = dflag;
XXXAZ(VSS_parse(T_arg, &addr, &port));
n = VSS_resolve(addr, port, &ta);
- free(addr);
- free(port);
if (n == 0) {
fprintf(stderr, "Could not open management port\n");
exit(2);
}
+ good = 0;
for (i = 0; i < n; ++i) {
sock = VSS_listen(ta[i], 10);
- assert(sock >= 0);
+ if (sock < 0)
+ continue;
+ good++;
tn = telnet_new(sock);
tn->ev = vev_new();
XXXAN(tn->ev);
@@ -486,5 +487,12 @@
ta[i] = NULL;
}
free(ta);
+ if (good == 0) {
+ REPORT(LOG_ERR, "-T %s:%s could not be listened on.",
+ addr, port);
+ exit(2);
+ }
+ free(addr);
+ free(port);
return (0);
}
More information about the varnish-commit
mailing list