If the kernel was built with USERCONFIG_BOOT, and the '-c' (RB_CONFIG) flag

was supplied to the kernel when booting, ignore any 'quit' commands in the
userconfig script.

This provides an escape mechanism whereby a broken userconfig script may
be worked around.
This commit is contained in:
Mike Smith 1998-02-10 00:10:35 +00:00
parent b5883d1eb4
commit f1353e56ee

View File

@ -46,7 +46,7 @@
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** $Id: userconfig.c,v 1.100 1998/01/21 19:23:33 jkh Exp $
** $Id: userconfig.c,v 1.101 1998/01/26 06:11:16 julian Exp $
**/
/**
@ -112,6 +112,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/reboot.h>
#include <machine/cons.h>
#include <machine/md_var.h>
@ -132,6 +133,7 @@ static struct isa_device *isa_devlist; /* list read by dset to extract changes *
#ifdef USERCONFIG_BOOT
char userconfig_from_boot[512] = "";
static int userconfig_boot_parsing; /* set if we are reading from the boot instructions */
static int
getchar(void)
@ -147,8 +149,10 @@ getchar(void)
}
}
if (*next) {
userconfig_boot_parsing = 1;
return (*next++);
} else {
userconfig_boot_parsing = 0;
return cngetc();
}
}
@ -2373,7 +2377,7 @@ visuserconfig(void)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: userconfig.c,v 1.100 1998/01/21 19:23:33 jkh Exp $
* $Id: userconfig.c,v 1.101 1998/01/26 06:11:16 julian Exp $
*/
#include "scbus.h"
@ -2836,6 +2840,15 @@ set_num_eisa_slots(CmdParm *parms)
static int
quitfunc(CmdParm *parms)
{
#ifdef USERCONFIG_BOOT
/*
* If kernel config supplied, and we are parsing it, and -c also supplied,
* ignore a quit command, This provides a safety mechanism to allow
* recovery from a damaged/buggy kernel config.
*/
if ((boothowto & RB_CONFIG) && userconfig_boot_parsing)
return 0;
#endif
return 1;
}