Commit a228a820 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't copy the debug flag around, make it a global instead.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3765 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 93124f03
......@@ -37,9 +37,10 @@
struct cli;
extern struct vev_base *mgt_evb;
extern unsigned d_flag;
/* mgt_child.c */
void mgt_run(int dflag, const char *T_arg);
void mgt_run(const char *T_arg);
extern pid_t mgt_pid, child_pid;
void mgt_stop_child(void);
......@@ -49,7 +50,7 @@ void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident);
int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...);
void mgt_cli_start_child(int fdi, int fdo);
void mgt_cli_stop_child(void);
void mgt_cli_telnet(int dflag, const char *T_arg);
void mgt_cli_telnet(const char *T_arg);
/* mgt_param.c */
void MCF_ParamSync(void);
......
......@@ -499,7 +499,7 @@ mgt_sigint(const struct vev *e, int what)
*/
void
mgt_run(int dflag, const char *T_arg)
mgt_run(const char *T_arg)
{
struct sigaction sac;
struct vev *e;
......@@ -510,11 +510,11 @@ mgt_run(int dflag, const char *T_arg)
mgt_evb = vev_new_base();
XXXAN(mgt_evb);
if (dflag)
if (d_flag)
mgt_cli_setup(0, 1, 1, "debug");
if (T_arg)
mgt_cli_telnet(dflag, T_arg);
mgt_cli_telnet(T_arg);
e = vev_new();
XXXAN(e);
......@@ -547,9 +547,9 @@ mgt_run(int dflag, const char *T_arg)
AZ(sigaction(SIGPIPE, &sac, NULL));
AZ(sigaction(SIGHUP, &sac, NULL));
if (!dflag && !mgt_has_vcl())
if (!d_flag && !mgt_has_vcl())
REPORT0(LOG_ERR, "No VCL loaded yet");
else if (!dflag) {
else if (!d_flag) {
start_child(NULL);
if (child_state == CH_STOPPED)
exit(2);
......
......@@ -74,8 +74,6 @@ static VTAILQ_HEAD(,telnet) telnets = VTAILQ_HEAD_INITIALIZER(telnets);
static void telnet_close_all(void);
static void telnet_close_one(int fd);
static int dflag_copy;
/*--------------------------------------------------------------------*/
static void
......@@ -335,7 +333,7 @@ mgt_cli_close(struct cli_port *cp)
(void)close(2);
assert(open("/dev/null", O_WRONLY) == 2);
if (dflag_copy == 2) {
if (d_flag == 2) {
mgt_stop_child();
telnet_close_all();
}
......@@ -475,15 +473,13 @@ telnet_accept(const struct vev *ev, int what)
}
void
mgt_cli_telnet(int dflag, const char *T_arg)
mgt_cli_telnet(const char *T_arg)
{
struct vss_addr **ta;
char *addr, *port;
int i, n, sock, good;
struct telnet *tn;
dflag_copy = dflag;
XXXAZ(VSS_parse(T_arg, &addr, &port));
n = VSS_resolve(addr, port, &ta);
if (n == 0) {
......
......@@ -78,6 +78,7 @@
struct heritage heritage;
volatile struct params *params;
unsigned d_flag = 0;
/*--------------------------------------------------------------------*/
......@@ -420,7 +421,6 @@ main(int argc, char * const *argv)
{
int o;
unsigned C_flag = 0;
unsigned d_flag = 0;
unsigned F_flag = 0;
const char *b_arg = NULL;
const char *f_arg = NULL;
......@@ -636,7 +636,7 @@ main(int argc, char * const *argv)
if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
mgt_run(d_flag, T_arg);
mgt_run(T_arg);
if (pfh != NULL)
(void)vpf_remove(pfh);
......
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