*BSD News Article 2719


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!mips!mips!swrinde!cs.utexas.edu!uunet!news.univie.ac.at!news.tu-graz.ac.at!fstgds01!chmr
From: chmr@fstgds01.tu-graz.ac.at (Christoph Robitschko)
Newsgroups: comp.unix.bsd
Subject: Bugs in init.c
Keywords: /sbin/init shutdown
Message-ID: <1992Jul29.122823.5474@news.tu-graz.ac.at>
Date: 29 Jul 92 12:28:23 GMT
Sender: news@news.tu-graz.ac.at (USENET News System)
Organization: Technical University of Graz, Austria
Lines: 55
Nntp-Posting-Host: fstgds01


I have found some bugs in /sbin/init. They caused the following behaviour:
	- init didn't execute /etc/rc again if you brought your system to
	  singleuser and then back up.
	- it didn't correctly react on TSTP siglals (which are sent by halt
	  and reboot). So it killed the user processes, but tried to start
	  new getty processes immediately, killed the getty processes, but 
	  tried to start new getty processes, ...
	- a lost semicolon at the end of a while loop.

The following patch fixes these problems. I have also sent a BUGNFIX.FORM
to ljolitz (about a week ago).

							Have fun,
							Christoph


cd /usr/src/sbin/init
diff -p init.c.ori init.c

*** init.c.ori	Mon Jul 20 16:03:40 1992
--- init.c	Mon Jul 20 17:57:51 1992
*************** top:
*** 188,194 ****
  				execl("/bin/sh", "sh", "/etc/rc", Reboot, (char *)0);
  				_exit(127);
  			}
! 			while(wait(&status) != pid)
  
  			/* if we are about to be rebooted, then wait for it */
  			if (WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL)
--- 188,195 ----
  				execl("/bin/sh", "sh", "/etc/rc", Reboot, (char *)0);
  				_exit(127);
  			}
! 			Reboot = 0;
! 			while(wait(&status) != pid);
  
  			/* if we are about to be rebooted, then wait for it */
  			if (WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL)
*************** top:
*** 215,220 ****
--- 216,223 ----
  			_exit(127);
  		}
  		while(wait(&status) != pid);
+ 		while (drain)
+ 			pause();
  		goto top;
  	}
  
-- 
------------------------------------------------------------------------
Christoph M. Robitschko  | "the only man who got his work done by Friday
chmr@edvz.tu-graz.ac.at  |             was Robinson Crusoe."