[comp.mail.mh] Fix to slocal

goldberg@russell.STANFORD.EDU (Jeffrey Goldberg) (12/11/87)

I have asked several times for a solution to the problem that
slocal has a habit of dumping core when run on Sun 3s.  I am happy
to report that I seem to have fixed to problem.

I have some patches that seem to fix the problem.  I am sure
that these could have been written much better.  I pointed out
in my first plea for help that I am not a programmer.  That is
still true; so if you have some modifications to these patches,
please let me know.  This is for MH6.5.  There were two files
that needed modifying.  One is uip/slocal.c and the other is
sbr/getcpy.c.  Here is the context diffs for slocal.c.  (There
is more text after the diff.)


*** slocal.c	Thu Dec 10 18:20:34 1987
--- slocal.c.orig	Thu Dec 10 18:20:35 1987
***************
*** 222,228 ****
  		case MAILSW: 
  		    if (!(cp = *argp++) || *cp == '-')
  			adios (NULLCP, "missing argument to %s", argp[-2]);
! 		    if (mdlvr != NULL)
  			adios (NULLCP, "only one maildelivery file at a time!");
  		    mdlvr = cp;
  		    continue;
--- 222,228 ----
  		case MAILSW: 
  		    if (!(cp = *argp++) || *cp == '-')
  			adios (NULLCP, "missing argument to %s", argp[-2]);
! 		    if (mdlvr)
  			adios (NULLCP, "only one maildelivery file at a time!");
  		    mdlvr = cp;
  		    continue;
***************
*** 333,348 ****
  char   *from,
         *mdlvr;
  {
!     if (mdlvr == NULL) 
! 	if (usr_delivery (fd, ".maildelivery", 0) != NOTOK)
! 	    {
! 	    return OK;
! 	    }
!     else
! 	if (usr_delivery (fd, mdlvr, 0) != NOTOK)
! 	    {
! 	    return OK;
! 	    }
  
      if (usr_delivery (fd, maildelivery, 1) != NOTOK)
  	return OK;
--- 333,340 ----
  char   *from,
         *mdlvr;
  {
!     if (usr_delivery (fd, mdlvr ? mdlvr : ".maildelivery", 0) != NOTOK)
! 	return OK;
  
      if (usr_delivery (fd, maildelivery, 1) != NOTOK)
  	return OK;



And here is the diff for getcpy:

*** getcpy.c	Thu Dec 10 18:23:12 1987
--- getcpy.c.orig	Thu Dec 10 18:23:12 1987
***************
*** 9,21 ****
  {
      register char  *cp;
  
-     if (str == NULLCP) {
- 	if ((cp = malloc ((unsigned) (1))) == NULL)
- 	    adios (NULLCP, "unable to allocate string storage");
- 	*cp = '\0';  /* A NULL pointer is not a null string */
- 	return cp;
-     }
- 
      if ((cp = malloc ((unsigned) (strlen (str) + 1))) == NULL)
  	adios (NULLCP, "unable to allocate string storage");
  
--- 9,14 ----
-- 
Jeff Goldberg         Internet: goldberg@russell.stanford.edu