Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
085c6a9f
Commit
085c6a9f
authored
Jun 08, 2017
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make varnishd -f honor the vcl_path
parent
afb5c068
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
9 deletions
+45
-9
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+25
-9
r02342.vtc
bin/varnishtest/tests/r02342.vtc
+20
-0
No files found.
bin/varnishd/mgt/mgt_main.c
View file @
085c6a9f
...
...
@@ -73,6 +73,9 @@ static char Cn_arg[] = "/tmp/varnishd_C_XXXXXXX";
static
struct
vpf_fh
*
pfh1
=
NULL
;
static
struct
vpf_fh
*
pfh2
=
NULL
;
static
struct
vfil_path
*
vcl_path
=
NULL
;
VTAILQ_HEAD
(,
f_arg
)
f_args
=
VTAILQ_HEAD_INITIALIZER
(
f_args
);
int
optreset
;
// Some has it, some doesn't. Cheaper than auto*
/*--------------------------------------------------------------------*/
...
...
@@ -442,6 +445,27 @@ struct f_arg {
VTAILQ_ENTRY
(
f_arg
)
list
;
};
static
void
mgt_f_read
(
const
char
*
fn
)
{
struct
f_arg
*
fa
;
char
*
f
,
*
fnp
;
ALLOC_OBJ
(
fa
,
F_ARG_MAGIC
);
AN
(
fa
);
REPLACE
(
fa
->
farg
,
fn
);
VFIL_setpath
(
&
vcl_path
,
mgt_vcl_path
);
if
(
VFIL_searchpath
(
vcl_path
,
NULL
,
&
f
,
fn
,
&
fnp
)
||
f
==
NULL
)
{
ARGV_ERR
(
"Cannot read -f file '%s' (%s)
\n
"
,
fnp
!=
NULL
?
fnp
:
fn
,
strerror
(
errno
));
free
(
fnp
);
}
free
(
fa
->
farg
);
fa
->
farg
=
fnp
;
fa
->
src
=
f
;
VTAILQ_INSERT_TAIL
(
&
f_args
,
fa
,
list
);
}
static
const
char
opt_spec
[]
=
"a:b:Cdf:Fh:i:I:j:l:M:n:P:p:r:S:s:T:t:VW:x:"
;
int
...
...
@@ -473,7 +497,6 @@ main(int argc, char * const *argv)
struct
vev
*
e
;
struct
f_arg
*
fa
;
struct
vsb
*
vsb
;
VTAILQ_HEAD
(,
f_arg
)
f_args
=
VTAILQ_HEAD_INITIALIZER
(
f_args
);
pid_t
pid
;
setbuf
(
stdout
,
NULL
);
...
...
@@ -626,14 +649,7 @@ main(int argc, char * const *argv)
novcl
=
1
;
break
;
}
ALLOC_OBJ
(
fa
,
F_ARG_MAGIC
);
AN
(
fa
);
REPLACE
(
fa
->
farg
,
optarg
);
fa
->
src
=
VFIL_readfile
(
NULL
,
fa
->
farg
,
NULL
);
if
(
fa
->
src
==
NULL
)
ARGV_ERR
(
"Cannot read -f file (%s): %s
\n
"
,
fa
->
farg
,
strerror
(
errno
));
VTAILQ_INSERT_TAIL
(
&
f_args
,
fa
,
list
);
mgt_f_read
(
optarg
);
break
;
case
'h'
:
h_arg
=
optarg
;
...
...
bin/varnishtest/tests/r02342.vtc
0 → 100644
View file @
085c6a9f
varnishtest "honor vcl_path with varnishd -f"
shell {
cat >unlikely_file_name.vcl <<-EOF
vcl 4.0;
backend be {
.host = "${bad_backend}";
}
EOF
}
shell -err -expect "Cannot read -f file 'unlikely_file_name.vcl'" {
varnishd -F -a :0 -n ${tmpdir}/tmp -f unlikely_file_name.vcl
}
varnish v1 -arg "-p vcl_path=${tmpdir} -f unlikely_file_name.vcl" -start
# Even when loaded from a relative path, show an absolute one
varnish v1 -cliexpect "VCL.SHOW .+ ${tmpdir}/unlikely_file_name.vcl" "vcl.show -v boot"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment