[net.news.b] bugs in inews.c

dmmartindale (06/23/82)

A couple of bugs in inews:
	The variable "tty" is used several times before it is actually set.
This breaks inews when it is supposed to read news from the terminal.  This bug
seems to have been present in 2.7 as well;  how did it go unnoticed?
	In the 2.8 release, someone fixed a bug which caused the child to
exit instead of the parent after a fork().  Unfortunately, there is another
call to fork farther down main with exactly the same bug.
	Hmm.  Perhaps the fact that it didn't fork properly until 2.8
masked bug #1?

	Dave Martindale


*** /usr/distr/news/2.8/src/inews.c	Tue Jun 22 16:42:14 1982
--- /usr/src/cmd/news/src/inews.c	Tue Jun 22 22:37:07 1982
***************
*** 198,203
  	 * ALL of the command line has now been processed. (!)
  	 */
  
  	if (!Dflag && mode != PROC) {
  		if (recording(header.nbuf)) {
  			if (!tty)

--- 198,204 -----
  	 * ALL of the command line has now been processed. (!)
  	 */
  
+ 	tty = isatty(fileno(stdin));
  	if (!Dflag && mode != PROC) {
  		if (recording(header.nbuf)) {
  			if (!tty)
***************
*** 222,228
  	if (*header.nbuf)
  		lcase(header.nbuf);
  	strcpy(header.path, gensender(username));
- 	tty = isatty(fileno(stdin));
  	if (mode == PROC) {
  		signal(SIGHUP, SIG_IGN);
  		signal(SIGINT, SIG_IGN);

--- 223,228 -----
  	if (*header.nbuf)
  		lcase(header.nbuf);
  	strcpy(header.path, gensender(username));
  	if (mode == PROC) {
  		signal(SIGHUP, SIG_IGN);
  		signal(SIGINT, SIG_IGN);
***************
*** 304,310
  
  	if (tty) {
  		i = fork();
! 		if (i == 0)
  			exit(0);
  	}
  

--- 304,310 -----
  
  	if (tty) {
  		i = fork();
! 		if (i != 0)
  			exit(0);
  	}