diff options
-rw-r--r-- | qmail-smtpd.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c index aaf65e8..580be77 100644 --- a/qmail-smtpd.c +++ b/qmail-smtpd.c @@ -26,6 +26,12 @@ #include "wait.h" #include "fd.h" +#ifdef NASTY_DEBUG +# include <stdio.h> +#endif /* NASTY_DEBUG */ + +void dummy() {} /* needed to make waitpid() work */ + // AUTHCRAM is not #defined for now, because: // 1) It requires cmd5checkpw (not just checkpassword), and // a) cmd5checkpw requires separate administration of the poppasswed file. @@ -577,7 +583,13 @@ int authenticate(void) close(pi[1]); byte_zero(pass.s,pass.len); byte_zero(upbuf,sizeof upbuf); - if (wait_pid(&wstat,child) == -1) return err_child(); + if (wait_pid(&wstat,child) == -1) { +#ifdef NASTY_DEBUG + fprintf(stderr, "kidpid: %d errno: %d : ", child, errno); + perror(0); +#endif /* NASTY_DEBUG */ + return err_child(); + } if (wait_crashed(wstat)) return err_child(); if (wait_exitcode(wstat)) { sleep(5); return 1; } /* no */ return 0; /* yes */ @@ -993,6 +1005,11 @@ void main(argc,argv) int argc; char **argv; { +/* waitpid() doesn't do what you expect + unless we do something nontrivial with SIGCHLD; + read the manpage. + */ + sig_childcatch(dummy); hostname = ""; if (argc > 1) hostname = argv[1]; childargs = 0; |