Commit 673c50de authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

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
parent 72d35747
......@@ -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');
......
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