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 --- passt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index a5e2c5a..aa9648a 100644 --- a/passt.c +++ b/passt.c @@ -302,7 +302,7 @@ int main(int argc, char **argv) if (isolate_prefork(&c)) die("Failed to sandbox process, exiting"); - if (!c.force_stderr && !isatty(fileno(stderr))) + if (!c.foreground || (!c.force_stderr && !isatty(fileno(stderr)))) __openlog(log_name, 0, LOG_DAEMON); if (!c.foreground) -- cgit v1.2.3