[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix for Irix SMTP problem



A while back, I complained that smtpserver sometimes talks gibberish
on the SMTP port, on SGI machines.  This would only happen when the
daemon was started without a controlling tty, as by cron, or via rsh,
or from our local batch system.

I have no real idea why, but the following patch fixes it.  The code
was trying to fflush() stdout and stderr after closing them.

*** 1.4	1992/11/05 17:38:11
--- smtpserver.c	1992/11/17 18:52:15
***************
*** 331,342 ****
  		killprevious(0, PID_SMTPSERVER);	/* deposit pid */
  		for (msgfd = getdtablesize() - 1; msgfd >= 0; --msgfd)
  			if (msgfd != s) {
- 				(void) close(msgfd);
  				/* junk any buffered output... */
  				if (msgfd == fileno(stdout))
  					(void) fflush(stdout);
  				else if (msgfd == fileno(stderr))
  					(void) fflush(stderr);
  			}
  		(void) signal(SIGCHLD, reaper);
  		(void) signal(SIGALRM, timedout);
--- 331,342 ----
  		killprevious(0, PID_SMTPSERVER);	/* deposit pid */
  		for (msgfd = getdtablesize() - 1; msgfd >= 0; --msgfd)
  			if (msgfd != s) {
  				/* junk any buffered output... */
  				if (msgfd == fileno(stdout))
  					(void) fflush(stdout);
  				else if (msgfd == fileno(stderr))
  					(void) fflush(stderr);
+ 				(void) close(msgfd);
  			}
  		(void) signal(SIGCHLD, reaper);
  		(void) signal(SIGALRM, timedout);