Download | Plain Text | No Line Numbers
- --- qmail-smtpd.c.orig Mon Jan 23 13:22:14 2006
- +++ qmail-smtpd.c Mon Jan 23 13:17:32 2006
- @@ -827,20 +827,22 @@
- int child;
- int wstat;
- int pi[2];
- + int stderrcopy;
-
- if (!stralloc_0(&user)) die_nomem();
- if (!stralloc_0(&pass)) die_nomem();
- if (!stralloc_0(&resp)) die_nomem();
-
- + stderrcopy = dup(2);
- + if (stderrcopy == -1) return err_pipe();
- if (fd_copy(2,1) == -1) return err_pipe();
- - close(3);
- if (pipe(pi) == -1) return err_pipe();
- - if (pi[0] != 3) return err_pipe();
- switch(child = fork()) {
- case -1:
- return err_fork();
- case 0:
- close(pi[1]);
- + if (0 > fd_copy(3,pi[0])) _exit(1);
- sig_pipedefault();
- execvp(*childargs, childargs);
- _exit(1);
- @@ -854,6 +856,8 @@
- if (substdio_flush(&ssup) == -1) return err_write();
-
- close(pi[1]);
- + dup2(stderrcopy, 2);
- + close(stderrcopy);
- byte_zero(pass.s,pass.len);
- byte_zero(upbuf,sizeof upbuf);
- if (wait_pid(&wstat,child) == -1) return err_child();
-