[net.notes] Bug in gtext.c

salkind (01/07/83)

#N:cmcl2:12700002:000:932
cmcl2!salkind    Jan  6 13:49:00 1983

Pardon me if this has already been fixed, but I've been away from
the notes scene for a while.

After editing text, an open file descriptor is never closed again.
This causes notes to run out of file descriptors and lock up after
invoking the editor about 14 times.

Here is a diff of the fix:

*** gtext.c.dist	Fri Jun 18 12:48:52 1982
--- gtext.c	Thu Jan  6 13:30:20 1983
***************
*** 47,52
      x ((scr = fopen (fn, "r")) == NULL, "gettext: scratch file");
  
      c = pagein (io, scr, where);			/* move text in */
      x (unlink (fn) < 0, "gettext: unlink");
      return c;						/* return count of characters moved */
  }

--- 47,53 -----
      x ((scr = fopen (fn, "r")) == NULL, "gettext: scratch file");
  
      c = pagein (io, scr, where);			/* move text in */
+     fclose (scr);
      x (unlink (fn) < 0, "gettext: unlink");
      return c;						/* return count of characters moved */
  }

-----

	Lou Salkind