[comp.mail.elm] Wnewmail core dumps

daemon@hplabsc.UUCP (05/20/87)

The emulation of cuserid() for BSD systems in file "src/opts_utils.c"
is buggy.  It does not emulate all the nuances of System V version
and wnewmail depends on it.

*** opt_utils.c.orig	Tue May 19 16:58:11 1987
--- opt_utils.c	Tue May 19 17:00:34 1987
***************
*** 43,48
  
  #ifdef NEED_CUSERID
  
  cuserid(uname)
  char *uname;
  {

--- 43,49 -----
  
  #ifdef NEED_CUSERID
  
+ char *
  cuserid(uname)
  char *uname;
  {
***************
*** 46,54
  cuserid(uname)
  char *uname;
  {
! 	/** Added for compatibility with Bell systems, this is the last-ditch
! 	    attempt to get the users login name, after getlogin() fails.  It
! 	    instantiates "uname" to the name of the user...
  	**/
  
  	struct passwd *password_entry, *getpwuid();

--- 47,54 -----
  cuserid(uname)
  char *uname;
  {
! 	/** Added for compatibility with Bell systems,
! 	    Check getlogin(), then the passwd file.
  	**/
  
  	char *name, *getlogin()
***************
*** 51,56
  	    instantiates "uname" to the name of the user...
  	**/
  
  	struct passwd *password_entry, *getpwuid();
  	static char buf[10];
  

--- 51,57 -----
  	    Check getlogin(), then the passwd file.
  	**/
  
+ 	char *name, *getlogin()
  	struct passwd *password_entry, *getpwuid();
  	static char buf[10];
  
***************
*** 54,60
  	struct passwd *password_entry, *getpwuid();
  	static char buf[10];
  
! 	password_entry = getpwuid(getuid());
  
  	strcpy(uname, password_entry->pw_name);
  }

--- 55,61 -----
  	struct passwd *password_entry, *getpwuid();
  	static char buf[10];
  
! 	if(uname == NULL) uname = buf;
  
  	if( (name = getlogin() != NULL) 
  		return strcpy(uname, name);
***************
*** 56,62
  
  	password_entry = getpwuid(getuid());
  
! 	strcpy(uname, password_entry->pw_name);
  }
  
  #endif

--- 57,67 -----
  
  	if(uname == NULL) uname = buf;
  
! 	if( (name = getlogin() != NULL) 
! 		return strcpy(uname, name);
! 	else if( (password_entry = getpwuid(getuid())) != NULL)
! 		return strcpy(uname, password_entry->pw_name);
! 	return NULL;
  }
  
  #endif