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
83d642bb
Commit
83d642bb
authored
Jan 08, 2016
by
Poul-Henning Kamp
Committed by
Lasse Karstensen
Jan 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanitize the VFIL_searchpath() caling convention to not need throwing
away const.
parent
d1d86be7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
21 deletions
+16
-21
mgt_vcl.c
bin/varnishd/mgt/mgt_vcl.c
+3
-2
vfil.h
include/vfil.h
+1
-1
vfil.c
lib/libvarnish/vfil.c
+9
-12
vcc_compile.c
lib/libvcc/vcc_compile.c
+2
-3
vcc_vmod.c
lib/libvcc/vcc_vmod.c
+1
-3
No files found.
bin/varnishd/mgt/mgt_vcl.c
View file @
83d642bb
...
...
@@ -282,12 +282,13 @@ mcf_vcl_load(struct cli *cli, const char * const *av, void *priv)
}
VFIL_setpath
(
&
vcl_path
,
mgt_vcl_dir
);
fn
=
TRUST_ME
(
av
[
3
]);
if
(
VFIL_searchpath
(
vcl_path
,
NULL
,
&
vcl
,
&
fn
))
{
if
(
VFIL_searchpath
(
vcl_path
,
NULL
,
&
vcl
,
av
[
3
],
&
fn
))
{
VCLI_Out
(
cli
,
"Cannot open '%s'"
,
fn
!=
NULL
?
fn
:
av
[
3
]);
REPLACE
(
fn
,
NULL
);
VCLI_SetResult
(
cli
,
CLIS_PARAM
);
return
;
}
REPLACE
(
fn
,
NULL
);
mgt_new_vcl
(
cli
,
av
[
2
],
vcl
,
av
[
4
],
0
);
free
(
vcl
);
...
...
include/vfil.h
View file @
83d642bb
...
...
@@ -39,5 +39,5 @@ int VFIL_allocate(int fd, off_t size, int insist);
void
VFIL_setpath
(
struct
vfil_path
**
,
const
char
*
path
);
typedef
int
vfil_path_func_f
(
void
*
priv
,
const
char
*
fn
);
int
VFIL_searchpath
(
const
struct
vfil_path
*
,
vfil_path_func_f
*
func
,
void
*
priv
,
c
har
**
fn
);
void
*
priv
,
c
onst
char
*
fni
,
char
**
fno
);
lib/libvarnish/vfil.c
View file @
83d642bb
...
...
@@ -298,41 +298,38 @@ vfil_path_openfile(void *priv, const char *fn)
int
VFIL_searchpath
(
const
struct
vfil_path
*
vp
,
vfil_path_func_f
*
func
,
void
*
priv
,
c
har
**
fnp
)
c
onst
char
*
fni
,
char
**
fno
)
{
struct
vsb
*
vsb
;
struct
vfil_dir
*
vd
;
const
char
*
fn
;
int
i
,
e
;
CHECK_OBJ_NOTNULL
(
vp
,
VFIL_PATH_MAGIC
);
AN
(
fnp
);
AN
(
*
fnp
);
fn
=
*
fnp
;
*
fnp
=
NULL
;
AN
(
fno
);
*
fno
=
NULL
;
if
(
func
==
NULL
)
{
func
=
vfil_path_openfile
;
AN
(
priv
);
}
if
(
*
fn
==
'/'
)
{
i
=
func
(
priv
,
fn
);
if
(
*
fn
i
==
'/'
)
{
i
=
func
(
priv
,
fn
i
);
if
(
i
<=
0
)
REPLACE
(
*
fn
p
,
fn
);
REPLACE
(
*
fn
o
,
fni
);
return
(
i
);
}
vsb
=
VSB_new_auto
();
AN
(
vsb
);
VTAILQ_FOREACH
(
vd
,
&
vp
->
paths
,
list
)
{
VSB_clear
(
vsb
);
VSB_printf
(
vsb
,
"%s/%s"
,
vd
->
dir
,
fn
);
VSB_printf
(
vsb
,
"%s/%s"
,
vd
->
dir
,
fn
i
);
AZ
(
VSB_finish
(
vsb
));
i
=
func
(
priv
,
VSB_data
(
vsb
));
if
(
i
<=
0
)
{
e
=
errno
;
*
fn
p
=
strdup
(
VSB_data
(
vsb
));
AN
(
*
fn
p
);
*
fn
o
=
strdup
(
VSB_data
(
vsb
));
AN
(
*
fn
o
);
VSB_delete
(
vsb
);
errno
=
e
;
return
(
i
);
...
...
lib/libvcc/vcc_compile.c
View file @
83d642bb
...
...
@@ -450,7 +450,7 @@ vcc_destroy_source(struct source *sp)
/*--------------------------------------------------------------------*/
static
struct
source
*
vcc_file_source
(
const
struct
vcp
*
const
vcp
,
struct
vsb
*
sb
,
char
*
fn
)
vcc_file_source
(
const
struct
vcp
*
const
vcp
,
struct
vsb
*
sb
,
c
onst
c
har
*
fn
)
{
char
*
f
,
*
fnp
;
struct
source
*
sp
;
...
...
@@ -460,8 +460,7 @@ vcc_file_source(const struct vcp * const vcp, struct vsb *sb, char *fn)
return
(
NULL
);
}
f
=
NULL
;
fnp
=
fn
;
if
(
VFIL_searchpath
(
vcp
->
vcl_path
,
NULL
,
&
f
,
&
fnp
)
||
f
==
NULL
)
{
if
(
VFIL_searchpath
(
vcp
->
vcl_path
,
NULL
,
&
f
,
fn
,
&
fnp
)
||
f
==
NULL
)
{
VSB_printf
(
sb
,
"Cannot read file '%s' (%s)
\n
"
,
fnp
!=
NULL
?
fnp
:
fn
,
strerror
(
errno
));
return
(
NULL
);
...
...
lib/libvcc/vcc_vmod.c
View file @
83d642bb
...
...
@@ -49,7 +49,6 @@ vcc_path_dlopen(void *priv, const char *fn)
AN
(
priv
);
AN
(
fn
);
fprintf
(
stderr
,
"TRY <%s>
\n
"
,
fn
);
hdl
=
dlopen
(
fn
,
RTLD_NOW
|
RTLD_LOCAL
);
if
(
hdl
==
NULL
)
return
(
1
);
...
...
@@ -126,9 +125,8 @@ vcc_ParseImport(struct vcc *tl)
SkipToken
(
tl
,
';'
);
fnp
=
fn
;
if
(
VFIL_searchpath
(
tl
->
param
->
vmod_path
,
vcc_path_dlopen
,
&
hdl
,
&
fnp
))
{
vcc_path_dlopen
,
&
hdl
,
fn
,
&
fnp
))
{
VSB_printf
(
tl
->
sb
,
"Could not load VMOD %.*s
\n
"
,
PF
(
mod
));
VSB_printf
(
tl
->
sb
,
"
\t
File name: %s
\n
"
,
fnp
!=
NULL
?
fnp
:
fn
);
VSB_printf
(
tl
->
sb
,
"
\t
dlerror: %s
\n
"
,
dlerror
());
...
...
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