error handling bug in sendoff() of sendmail 5.65

DEMIZU Noritoshi demizu at nff.ncl.omron.co.jp
Sat May 4 17:24:44 AEST 1991


sendoff() defined in deliver.c calls openmailer().  If the return
value of openmailer() was negative, sendoff() returns -1.  This will
cause fatal error.  The E-mail will be sent back to sender.  But
openmailer() returns negative value even if the error is not fatal.
For example, when it failed to create pipe, or when it failed to fork.

So I think sendoff() returns ExitStat in stead of -1.  And the global
variable ExitStat should be set to have proper status in openmailer().

Excuse my English.

 --- DEMIZU Noritoshi    OMRON Corporation

=====================================================================
*** src/deliver.c.ORG	Sat May  4 14:32:51 1991
--- src/deliver.c	Sat May  4 14:33:45 1991
***************
*** 600,606 ****
  
  	pid = openmailer(m, pvp, ctladdr, FALSE, &mfile, &rfile);
  	if (pid < 0)
! 		return (-1);
  
  	/*
  	**  Format and send message.
--- 600,606 ----
  
  	pid = openmailer(m, pvp, ctladdr, FALSE, &mfile, &rfile);
  	if (pid < 0)
! 		return ExitStat;
  
  	/*
  	**  Format and send message.
***************
*** 799,804 ****
--- 799,805 ----
  	if (pipe(mpvect) < 0)
  	{
  		syserr("openmailer: pipe (to mailer)");
+ 		ExitStat = EX_TEMPFAIL;
  		return (-1);
  	}
  
***************
*** 809,814 ****
--- 810,816 ----
  		syserr("openmailer: pipe (from mailer)");
  		(void) close(mpvect[0]);
  		(void) close(mpvect[1]);
+ 		ExitStat = EX_TEMPFAIL;
  		return (-1);
  	}
  #endif SMTP
***************
*** 842,847 ****
--- 844,850 ----
  			(void) close(rpvect[1]);
  		}
  #endif SMTP
+ 		ExitStat = EX_TEMPFAIL;
  		return (-1);
  	}
  	else if (pid == 0)
*** support/getloadavg.c.ORG	Sat May  4 15:58:47 1991
--- support/getloadavg.c	Sat May  4 15:58:59 1991
***************
*** 42,47 ****
  			return (-1);
  	}
  	if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 ||
! 	    read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
  		return (-1);
  }
--- 42,47 ----
  			return (-1);
  	}
  	if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 ||
! 	    read(kmem, (char *) avenrun, sizeof(*avenrun)) < sizeof(*avenrun))
  		return (-1);
  }
=====================================================================
--
;  DEMIZU, Noritoshi		OMRON Computer Systems R&D laboratory
;  demizu at nff.ncl.omron.co.jp	tel: 075-951-5111  fax: 075-956-7403



More information about the Comp.bugs.4bsd.ucb-fixes mailing list