Index: b/libdaemon/dfork.c =================================================================== --- a/libdaemon/dfork.c +++ b/libdaemon/dfork.c @@ -529,10 +529,13 @@ int daemon_close_allv(const int except_f closedir(d); errno = saved_errno; return -1; } + + if (fd == _daemon_retval_pipe[0]) + _daemon_retval_pipe[0] = -1; /* mark as closed */ } closedir(d); return 0; } @@ -561,10 +564,13 @@ int daemon_close_allv(const int except_f if (found) continue; if (close(fd) < 0 && errno != EBADF) return -1; + + if (fd == _daemon_retval_pipe[0]) + _daemon_retval_pipe[0] = -1; /* mark as closed */ } return 0; }