[master] 673c50d Fix parsing of -T and -S arguments from shared memory in varnishadm when using the -n option.
Martin Blix Grydeland
martin at varnish-cache.org
Tue Jul 3 15:03:36 CEST 2012
commit 673c50deaa447eb80c7830f2adef0749347f44bc
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Tue Jul 3 13:30:40 2012 +0200
Fix parsing of -T and -S arguments from shared memory in varnishadm
when using the -n option.
Code had reversed the no -T argument error check, and also required
the optional -S argument to be present.
Fixes: #1160
diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index f4c262c..3dc7c79 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -298,20 +298,19 @@ n_arg_sock(const char *n_arg)
fprintf(stderr, "%s\n", VSM_Error(vsd));
return (-1);
}
- if (T_arg == NULL) {
- if (VSM_Get(vsd, &vt, "Arg", "-T", "")) {
- fprintf(stderr, "No -T arg in shared memory\n");
- return (-1);
- }
- T_start = T_arg = strdup(vt.b);
+
+ if (!VSM_Get(vsd, &vt, "Arg", "-T", "")) {
+ fprintf(stderr, "No -T arg in shared memory\n");
+ return (-1);
}
- if (S_arg == NULL) {
- if (VSM_Get(vsd, &vt, "Arg", "-S", "")) {
- fprintf(stderr, "No -S arg in shared memory\n");
- return (-1);
- }
+ AN(vt.b);
+ T_start = T_arg = strdup(vt.b);
+
+ if (VSM_Get(vsd, &vt, "Arg", "-S", "")) {
+ AN(vt.b);
S_arg = strdup(vt.b);
}
+
sock = -1;
while (*T_arg) {
p = strchr(T_arg, '\n');
More information about the varnish-commit
mailing list