dissect calls fclose with a possibly NULL pointer

Reid Ellis rae at geaclib.UUCP
Fri Feb 3 08:33:14 AEST 1989


I'm not sure how other systems handle it, but Ultrix does not like fclose()
being called with a NULL pointer as an argument.  Here is a patch to fix
the file "dissect.c":

*** dissect.old	Thu Feb  2 17:27:02 1989
--- dissect.c	Thu Feb  2 17:26:32 1989
***************
*** 46,52
      if ((!strncmp (line, "From ", 5)) && (*last == '\n')) {
        flag++;
        if (!onlycount) {
! 	(void) fclose (to);
  	(void) strcpy (name, line+5);
  	for (cp = name; (*cp != ' ') && (*cp != '@') && (*cp != '%'); cp++);
  	*cp = '\0';

--- 46,52 -----
      if ((!strncmp (line, "From ", 5)) && (*last == '\n')) {
        flag++;
        if (!onlycount) {
! 	if(to) { (void) fclose (to); }
  	(void) strcpy (name, line+5);
  	for (cp = name; (*cp != ' ') && (*cp != '@') && (*cp != '%'); cp++);
  	*cp = '\0';

Reid



More information about the Comp.sources.bugs mailing list