[master] 3dd6aa06e Only MGT_Complain() on stderr when -d or -F flags given.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Aug 10 07:28:09 UTC 2021
commit 3dd6aa06e53a2341b3a5a903a55e620f11eef8be
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 10 06:58:40 2021 +0000
Only MGT_Complain() on stderr when -d or -F flags given.
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 02a17f88a..bf0bacca9 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -176,6 +176,7 @@ extern const char C_INFO[]; // Normal stuff, keep a record for later
extern const char C_DEBUG[]; // More detail than you'd normally want
extern const char C_SECURITY[]; // Security issues
extern const char C_CLI[]; // CLI traffic between master and child
+extern int complain_to_stderr;
/* mgt_param.c */
void MCF_InitParams(struct cli *);
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index f16e13127..dca5c4b52 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -579,6 +579,9 @@ main(int argc, char * const *argv)
if (!d_flag && b_arg == NULL && !f_flag)
ARGV_ERR("Neither -b nor -f given. (use -f '' to override)\n");
+ if (d_flag || F_flag)
+ complain_to_stderr = 1;
+
/*
* Start out by closing all unwanted file descriptors we might
* have inherited from sloppy process control daemons.
diff --git a/bin/varnishd/mgt/mgt_util.c b/bin/varnishd/mgt/mgt_util.c
index 889fdc69b..d9ec5a0f1 100644
--- a/bin/varnishd/mgt/mgt_util.c
+++ b/bin/varnishd/mgt/mgt_util.c
@@ -49,6 +49,8 @@
#include "vav.h"
#include "vct.h"
+int complain_to_stderr;
+
/*--------------------------------------------------------------------*/
char *
@@ -170,7 +172,7 @@ MGT_Complain(const char *loud, const char *fmt, ...)
else
WRONG("Wrong complaint loudness");
- if (loud != C_CLI)
+ if (complain_to_stderr && loud != C_CLI)
fprintf(stderr, "%s %s\n", loud, VSB_data(vsb));
if (!MGT_DO_DEBUG(DBG_VTC_MODE))
More information about the varnish-commit
mailing list