From b74801645c23bbb349df7522663f9ac253d6dc95 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 6 Jun 2024 17:18:32 +0200 Subject: conf, passt: Don't try to log to stderr after we close it If we don't run in foreground, we close standard error as we daemonise, so it makes no sense to check if the controlling terminal is an interactive terminal or if --force-stderr was given, to decide if we want to log to standard error. Make --force-stderr depend on --foreground. Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- conf.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 4fff2b1..8687e43 100644 --- a/conf.c +++ b/conf.c @@ -1631,6 +1631,9 @@ void conf(struct ctx *c, int argc, char **argv) conf_ugid(runas, &uid, &gid); + if (!c->foreground && c->force_stderr) + die("Can't log to standard error if not running in foreground"); + if (logfile) { logfile_init(c->mode == MODE_PASTA ? "pasta" : "passt", logfile, logsize); -- cgit v1.2.3