[comp.os.minix] bug in init.c

leo@marco.UUCP (Matthias Pfaller) (07/02/90)

There is (I think) a bug in init.c. If you use pipes in /etc/rc not all
processes are children of the shell executing /etc/rc. So init adopts them
and continues after their termination instead of after the termination of
/etc/rc.
	Matthias Pfaller (leo@verw.marco.de)

*** init.c	Fri Jun  1 11:15:23 1990
--- init.c.new	Mon Jul  2 08:48:13 1990
***************
*** 122,130 ****
    sync();			/* force buffers out onto disk */
  
    /* Execute the /etc/rc file. */
!   if(fork()) {
  	/* Parent just waits. */
! 	wait(&status);
    } else {
  	/* Child exec's the shell to do the work. */
  	if(open("/etc/rc", 0) < 0) exit(EXIT_OPENFAIL);
--- 122,131 ----
    sync();			/* force buffers out onto disk */
  
    /* Execute the /etc/rc file. */
!   if(pid = fork()) {
  	/* Parent just waits. */
! 	while (wait(&status) != pid)
! 		;
    } else {
  	/* Child exec's the shell to do the work. */
  	if(open("/etc/rc", 0) < 0) exit(EXIT_OPENFAIL);