From 84a62b79a2bccb8b7db24e230854a7b160c0851b Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Fri, 21 May 2021 11:22:04 +0200 Subject: passt: Also log to stderr, don't fork to background if not interactive Signed-off-by: Stefano Brivio --- passt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index a057d46..3637e48 100644 --- a/passt.c +++ b/passt.c @@ -797,7 +797,7 @@ int main(int argc, char **argv) #if DEBUG openlog("passt", LOG_PERROR, LOG_DAEMON); #else - openlog("passt", 0, LOG_DAEMON); + openlog("passt", isatty(fileno(stdout)) ? 0 : LOG_PERROR, LOG_DAEMON); #endif get_routes(&c); @@ -870,7 +870,7 @@ listen: " -net nic,model=virtio", sock_index); #ifndef DEBUG - if (daemon(0, 0)) { + if (isatty(fileno(stdout)) && daemon(0, 0)) { fprintf(stderr, "Failed to fork into background\n"); exit(EXIT_FAILURE); } -- cgit v1.2.3