diff --git a/src/ostree/ostree-trivial-httpd.c b/src/ostree/ostree-trivial-httpd.c index ef297af6..ddcb2fc0 100644 --- a/src/ostree/ostree-trivial-httpd.c +++ b/src/ostree/ostree-trivial-httpd.c @@ -30,6 +30,7 @@ #include "otutil.h" #include +#include #include #include #include @@ -597,9 +598,12 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) goto out; } /* Child, continue */ + if (setsid () < 0) + err (1, "setsid"); /* Daemonising: close stdout/stderr so $() et al work on us */ - fclose (stdout); - fclose (stdin); + freopen("/dev/null", "r", stdin); + freopen("/dev/null", "w", stdout); + freopen("/dev/null", "w", stderr); } else {