r3666 - branches/2.0/varnish-cache/bin/varnishd
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Fri Feb 6 14:22:01 CET 2009
Author: tfheen
Date: 2009-02-06 14:22:01 +0100 (Fri, 06 Feb 2009)
New Revision: 3666
Modified:
branches/2.0/varnish-cache/bin/varnishd/mgt_cli.c
Log:
Merge r3473:
Only fail -T argument if none of the addresses it resolves to
can be listend on.
Fixes #97
Modified: branches/2.0/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/mgt_cli.c 2009-02-06 13:17:49 UTC (rev 3665)
+++ branches/2.0/varnish-cache/bin/varnishd/mgt_cli.c 2009-02-06 13:22:01 UTC (rev 3666)
@@ -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