NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/55605: [PATCH] script(1): does not wait on child pid when stdin is not a tty



The following reply was made to PR bin/55605; it has been noted by GNATS.

From: Soumendra Ganguly <soumendra%tamu.edu@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/55605: [PATCH] script(1): does not wait on child pid when
 stdin is not a tty
Date: Mon, 24 Aug 2020 19:03:23 -0500

 --- src/usr.bin/script/script.c	2020-08-24 17:27:30.907579625 -0500
 +++ script.c	2020-08-24 18:51:36.715164374 -0500
 @@ -204,7 +204,8 @@
  			record(fscript, ibuf, cc, 'i');
  		(void)write(master, ibuf, cc);
  	}
 -	done();
 +	while (1) /* Wait for SIGCHLD. */
 +		sleep(1);
  	/* NOTREACHED */
  	return EXIT_SUCCESS;
  }
 @@ -249,7 +250,7 @@
  		if (scc <= 0)
  			break;
  		cc = (size_t)scc;
 -		(void)write(1, obuf, cc);
 +		(void)write(STDOUT_FILENO, obuf, cc);
  		if (rawout)
  			record(fscript, obuf, cc, 'o');
  		else
 @@ -258,7 +259,8 @@
  		if (flush)
  			(void)fflush(fscript);
  	}
 -	done();
 +	while (1) /* Wait for SIGCHLD. */
 +		sleep(1);
  }
 
  static void
 
 
 On 8/24/20, Soumendra Ganguly <soumendra%tamu.edu@localhost> wrote:
 > I made a slight modification to the patch. Since finish() calls
 > wait3() anyway, I decided to remove the ambiguous waitpid()s that I
 > added [ not sure if they will succeed or EINTR out due to SIGCHLD ]
 > and replace them with simple while loops. The next message will
 > contain the modified patch [ inline ].
 >
 > On 8/24/20, gnats-admin%netbsd.org@localhost <gnats-admin%netbsd.org@localhost> wrote:
 >> Thank you very much for your problem report.
 >> It has the internal identification `bin/55605'.
 >> The individual assigned to look at your
 >> report is: bin-bug-people.
 >>
 >>>Category:       bin
 >>>Responsible:    bin-bug-people
 >>>Synopsis:       [PATCH] script(1): does not wait on child pid when stdin
 >>> is
 >>> not a tty
 >>>Arrival-Date:   Mon Aug 24 22:55:00 +0000 2020
 >>
 >>
 >
 



Home | Main Index | Thread Index | Old Index