1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-20 16:35:33 +02:00

log, passt: Keep printing to stderr when passt is running in foreground

There are two cases where we want to stop printing to stderr: if it's
closed, and if pasta spawned a shell (and --debug wasn't given).

But if passt is running in foreground, we currently stop to report any
message, even error messages, once we're ready, as reported by
Laurent, because we set the log_runtime flag, which we use to indicate
we're ready, regardless of whether we're running in foreground or not.

Turn that flag (back) to log_stderr, and set it only when we really
want to stop printing to stderr.

Reported-by: Laurent Vivier <lvivier@redhat.com>
Fixes: afd9cdc9bb ("log, passt: Always print to stderr before initialisation is complete")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2024-08-06 14:07:37 +02:00
parent 3a082c4ecb
commit ee36266a55
3 changed files with 11 additions and 9 deletions

12
passt.c
View file

@ -290,15 +290,17 @@ int main(int argc, char **argv)
if (isolate_prefork(&c))
die("Failed to sandbox process, exiting");
if (!c.foreground)
if (!c.foreground) {
__daemon(c.pidfile_fd, devnull_fd);
else
log_stderr = false;
} else {
pidfile_write(c.pidfile_fd, getpid());
}
log_runtime = true;
if (pasta_child_pid)
if (pasta_child_pid) {
kill(pasta_child_pid, SIGUSR1);
log_stderr = false;
}
isolate_postfork(&c);