Bruce Evans <b...@optusnet.com.au> writes: > Even if the child causes the flush, the content of stdout and stderr > is not flushed normally since it is redirected to /dev/null. Unflushed > input in stdin is handled more brokenly: although stdin is redirected > to /dev/null, input on it can still be read via stdin's buffer. > Inheriting unflushed input on other streams is a feature (unless these > streams are open on fd's 0-2; then these streams will have the same > corruption as std* streams open on their normal fd's 0-2).
how about Index: gen/daemon.c =================================================================== --- gen/daemon.c (revision 204870) +++ gen/daemon.c (working copy) @@ -37,6 +37,7 @@ #include <errno.h> #include <fcntl.h> #include <paths.h> +#include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> @@ -81,6 +82,9 @@ (void)chdir("/"); if (!noclose && (fd = _open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + fpurge(stdin); + fflush(stdout); + fflush(stderr); (void)_dup2(fd, STDIN_FILENO); (void)_dup2(fd, STDOUT_FILENO); (void)_dup2(fd, STDERR_FILENO); ? DES -- Dag-Erling Smørgrav - d...@des.no _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"