From 875550b9733eb35b25de3b70569bcc7233ae52cb Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 21 Oct 2021 20:13:18 +0200 Subject: passt: Fork into background also if not running from a terminal This is actually annoying: there's no way to make it fork into background when running from a script. However, it's always possible to keep it in foreground with -f. Make it simpler, and always fork into background if -f is not given. Signed-off-by: Stefano Brivio --- passt.1 | 2 +- passt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/passt.1 b/passt.1 index 1654173..b0d7d87 100644 --- a/passt.1 +++ b/passt.1 @@ -81,7 +81,7 @@ Don't print informational messages. .TP .BR \-f ", " \-\-foreground Don't run in background. -Default is to fork into background, if started from an interactive terminal. +Default is to fork into background. .TP .BR \-e ", " \-\-stderr diff --git a/passt.c b/passt.c index 6e5a72a..399cc08 100644 --- a/passt.c +++ b/passt.c @@ -365,7 +365,7 @@ int main(int argc, char **argv) else __setlogmask(LOG_UPTO(LOG_INFO)); - if (isatty(fileno(stdout)) && !c.foreground && daemon(0, 0)) { + if (!c.foreground && daemon(0, 0)) { perror("daemon"); exit(EXIT_FAILURE); } -- cgit v1.2.3