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
cc2af9ea
Commit
cc2af9ea
authored
Mar 12, 2017
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When using -C remove temporary directories on exit
OK phk.
parent
91047a9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+21
-10
No files found.
bin/varnishd/mgt/mgt_main.c
View file @
cc2af9ea
...
...
@@ -68,6 +68,7 @@ struct vsb *vident;
struct
VSC_C_mgt
static_VSC_C_mgt
;
struct
VSC_C_mgt
*
VSC_C_mgt
;
static
int
I_fd
=
-
1
;
char
Cn_arg
[]
=
"/tmp/varnishd_C_XXXXXXX"
;
static
struct
vpf_fh
*
pfh
=
NULL
;
...
...
@@ -230,6 +231,17 @@ make_secret(const char *dirname)
return
(
fn
);
}
static
void
mgt_Cflag_atexit
(
void
)
{
/* Only master process */
if
(
getpid
()
!=
mgt_pid
)
return
;
(
void
)
rmdir
(
"vmod_cache"
);
(
void
)
rmdir
(
Cn_arg
);
}
/*--------------------------------------------------------------------*/
static
void
...
...
@@ -481,7 +493,6 @@ main(int argc, char * const *argv)
struct
cli
cli
[
1
];
char
*
dirname
;
char
**
av
;
char
Cn_arg
[]
=
"/tmp/varnishd_C_XXXXXXX"
;
unsigned
u
;
struct
sigaction
sac
;
struct
vev
*
e
;
...
...
@@ -728,14 +739,6 @@ main(int argc, char * const *argv)
}
assert
(
argc
==
optind
);
if
(
C_flag
)
{
if
(
n_arg
==
NULL
)
{
AN
(
mkdtemp
(
Cn_arg
));
AZ
(
chmod
(
Cn_arg
,
0755
));
n_arg
=
Cn_arg
;
}
}
/* XXX: we can have multiple CLI actions above, is this enough ? */
if
(
cli
[
0
].
result
!=
CLIS_OK
)
{
AZ
(
VSB_finish
(
cli
[
0
].
sb
));
...
...
@@ -745,6 +748,15 @@ main(int argc, char * const *argv)
assert
(
d_flag
==
0
||
F_flag
==
0
);
if
(
C_flag
)
{
if
(
n_arg
==
NULL
)
{
AN
(
mkdtemp
(
Cn_arg
));
AZ
(
chmod
(
Cn_arg
,
0755
));
AZ
(
atexit
(
mgt_Cflag_atexit
));
n_arg
=
Cn_arg
;
}
}
if
(
S_arg
!=
NULL
&&
!
strcmp
(
S_arg
,
"none"
))
{
fprintf
(
stderr
,
"Warning: CLI authentication disabled.
\n
"
);
...
...
@@ -801,7 +813,6 @@ main(int argc, char * const *argv)
fprintf
(
stderr
,
"%s
\n
"
,
VSB_data
(
cli
->
sb
));
VSB_clear
(
cli
->
sb
);
}
(
void
)
rmdir
(
Cn_arg
);
exit
(
cli
->
result
==
CLIS_OK
?
0
:
2
);
}
else
{
while
(
!
VTAILQ_EMPTY
(
&
f_args
))
{
...
...
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