aboutgitcodebugslistschat
path: root/passt.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-08-06 14:07:37 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-08-06 15:03:48 +0200
commitee36266a55478672ad2c5f4efbd6ca0bef3d37cd (patch)
treea9d4c6b6e8d6cba8f3b95a43f89587f3da7a1321 /passt.c
parent3a082c4ecb4b50d44aff21a1390826cd3a3d077e (diff)
downloadpasst-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.tar
passt-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.tar.gz
passt-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.tar.bz2
passt-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.tar.lz
passt-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.tar.xz
passt-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.tar.zst
passt-ee36266a55478672ad2c5f4efbd6ca0bef3d37cd.zip
log, passt: Keep printing to stderr when passt is running in foreground2024_08_06.ee36266
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: afd9cdc9bb48 ("log, passt: Always print to stderr before initialisation is complete") Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r--passt.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/passt.c b/passt.c
index 6401730..ea5bece 100644
--- a/passt.c
+++ b/passt.c
@@ -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);