Mailing List Archive

[master] a02743ccb Make sure complaints from the starting child process reach stderr
commit a02743ccb051b81da8c71d5a68c9afcc68829b28
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Tue Mar 7 11:33:55 2023 +0000

Make sure complaints from the starting child process reach stderr

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 2776f9de6..0bb82c51c 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -233,12 +233,14 @@ MCH_Fd_Inherit(int fd, const char *what)
* Listen to stdout+stderr from the child
*/

+static const char *whining_child = C_ERR;
+
static int v_matchproto_(vlu_f)
child_line(void *priv, const char *p)
{
(void)priv;

- MGT_Complain(C_INFO, "Child (%jd) said %s", (intmax_t)child_pid, p);
+ MGT_Complain(whining_child, "Child (%jd) said %s", (intmax_t)child_pid, p);
return (0);
}

@@ -435,6 +437,7 @@ mgt_launch_child(struct cli *cli)
assert(u == CLIS_OK);
fprintf(stderr, "Child launched OK\n");
}
+ whining_child = C_INFO;

AZ(ev_listen);
e = VEV_Alloc();
diff --git a/bin/varnishd/mgt/mgt_util.c b/bin/varnishd/mgt/mgt_util.c
index d9ec5a0f1..f43b43b0d 100644
--- a/bin/varnishd/mgt/mgt_util.c
+++ b/bin/varnishd/mgt/mgt_util.c
@@ -172,7 +172,7 @@ MGT_Complain(const char *loud, const char *fmt, ...)
else
WRONG("Wrong complaint loudness");

- if (complain_to_stderr && loud != C_CLI)
+ if (loud != C_CLI && (complain_to_stderr || loud != C_DEBUG))
fprintf(stderr, "%s %s\n", loud, VSB_data(vsb));

if (!MGT_DO_DEBUG(DBG_VTC_MODE))
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit