Ben Lentz wrote:
One more thing... it looks like daemon mode doesn't detach from it's
controlling terminal, still shows "pts/1", and hangs upon logout:
Added setsid(), patch attached.
Applied. Thanks again.
Hmmm... file descriptors for STDIN, STDOUT, and STDERR should be closed,
too... the setsid() detaches the controlling terminal but a terminal
still hangs at logout after starting the daemon. A quick-and-dirty patch
is attached, but there's probably a "better" way to do this.
Thanks very much for considering my patches! I really appreciate the
work you've done implementing my suggestions!
--- src/main.c.orig 2008-01-04 21:19:52.000000000 -0500
+++ src/main.c 2008-01-04 21:42:52.000000000 -0500
@@ -287,6 +287,10 @@
exit(EXIT_FAILURE);
}
+ close(0);
+ close(1);
+ close(2);
+
dlog(STATE(log), LOG_NOTICE, "-- starting in daemon mode --");
} else
dlog(STATE(log), LOG_NOTICE, "-- starting in console mode --");