[news.software.nntp] nntp 1.5.9 SETPROCTITLE stuff

leres@ace.ee.lbl.gov (Craig Leres) (08/11/90)

By now, most everyone knows that the SETPROCTITLE code in 1.5.9 can
cause problems with later exec's. This problem would have been easier
to diagnose except that it's hidden by another bug; the "child" can't
syslog() because the syslog socket has been closed. The fix is to
closelog() before the close() loop so that syslog() will know to reopen
its fd the first time it tries to log an error (say with E2BIG after
the exec fails...) Context diffs follow.

		Craig
------
*** spawn.c.old Fri Aug 10 15:43:12 1990
--- spawn.c.new Fri Aug 10 15:47:23 1990
***************
*** 1,5 ****
  #ifndef lint
! static	char	*sccsid = "@(#)$Header: spawn.c,v 1.1 90/07/29 02:15:32 
leres Exp $";
  #endif
  
  #include "common.h"
--- 1,5 ----
  #ifndef lint
! static	char	*sccsid = "@(#)$Header: spawn.c,v 1.1+ 90/07/29 02:15:32
 leres Exp $";
  #endif
  
  #include "common.h"
***************
*** 168,173 ****
--- 168,177 ----
		}
		(void) dup2(1, 2);
  
+ #ifdef SYSLOG
+		/* Close in such a way that syslog() will know to reopen */
+		closelog();
+ #endif
		for (i = 3; i < 10; ++i) /* XXX but getdtablesize is too big */
			(void) close(i);

diff -c batch.c.old batch.c.new
*** batch.c.old Fri Aug 10 15:41:59 1990
--- batch.c.new Fri Aug 10 15:47:16 1990
***************
*** 1,5 ****
  #ifndef lint
! static	char	*rcsid = "@(#)$Header: batch.c,v 1.1 90/07/29 03:06:18 l
eres Exp $";
  #endif
  /*
   * Batch subroutine for Cnews.
--- 1,5 ----
  #ifndef lint
! static	char	*rcsid = "@(#)$Header: batch.c,v 1.1+ 90/07/29 03:06:18 
leres Exp $";
  #endif
  /*
   * Batch subroutine for Cnews.
***************
*** 365,370 ****
--- 365,374 ----
  #endif
  
	/* child: must exit */
+ #ifdef SYSLOG
+	/* Close in such a way that syslog() will know to reopen */
+	closelog();
+ #endif
	for (fd = 3; fd < 20; fd++)
		(void) close(fd);
	if (chdir(INDIR) < 0) {