Index: libgamin/gam_fork.c =================================================================== RCS file: /cvs/gnome/gamin/libgamin/gam_fork.c,v retrieving revision 1.11 diff -u -p -r1.11 gam_fork.c --- libgamin/gam_fork.c 27 Oct 2005 10:58:50 -0000 1.11 +++ libgamin/gam_fork.c 22 Aug 2006 14:59:11 -0000 @@ -67,6 +67,7 @@ gamin_fork_server(const char *fam_client /* Become a daemon */ pid = fork(); if (pid == 0) { + int fd; long open_max; long i; @@ -75,6 +76,20 @@ gamin_fork_server(const char *fam_client for (i = 0; i < open_max; i++) fcntl (i, F_SETFD, FD_CLOEXEC); + /* /dev/null for stdin, stdout, stderr */ + fd = open ("/dev/null", O_RDONLY); + if (fd != -1) { + dup2 (fd, 0); + close (fd); + } + + fd = open ("/dev/null", O_WRONLY); + if (fd != -1) { + dup2 (fd, 1); + dup2 (fd, 2); + close (fd); + } + setsid(); if (fork() == 0) { #ifdef HAVE_SETENV