diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-05-21 11:22:04 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-05-21 11:22:04 +0200 |
commit | 84a62b79a2bccb8b7db24e230854a7b160c0851b (patch) | |
tree | 0a077b18837d4a2a34628b86a03f849be8737c0a /passt.c | |
parent | 9311ceb8b6fe7064cffca3efda051ef1e1801642 (diff) | |
download | passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.tar passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.tar.gz passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.tar.bz2 passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.tar.lz passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.tar.xz passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.tar.zst passt-84a62b79a2bccb8b7db24e230854a7b160c0851b.zip |
passt: Also log to stderr, don't fork to background if not interactive
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r-- | passt.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); } |