Index: contrib/mod_exec.c =================================================================== RCS file: /cvsroot/proftp/proftpd/contrib/mod_exec.c,v retrieving revision 1.24 diff -u -r1.24 mod_exec.c --- contrib/mod_exec.c 12 Dec 2011 19:22:37 -0000 1.24 +++ contrib/mod_exec.c 13 Dec 2011 21:29:25 -0000 @@ -626,7 +626,7 @@ (void) close(exec_stderr_pipe[1]); exec_stderr_pipe[1] = -1; - + if ((exec_opts & EXEC_OPT_LOG_STDOUT) || (exec_opts & EXEC_OPT_LOG_STDERR) || (exec_opts & EXEC_OPT_SEND_STDOUT) || @@ -636,7 +636,10 @@ struct timeval tv; time_t start_time = time(NULL); - res = waitpid(pid, &status, WNOHANG); + /* We set the result value to zero initially, so that at least one + * pass through the stdout/stderr reading code happens. + */ + res = 0; while (res <= 0) { if (res < 0) { if (errno != EINTR) { @@ -698,7 +701,6 @@ tv.tv_usec = 0L; fds = select(maxfd + 1, &readfds, NULL, NULL, &tv); - if (fds == -1 && errno == EINTR) { pr_signals_handle();