summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-02-10 00:10:35 +0000
committermsmith <msmith@FreeBSD.org>1998-02-10 00:10:35 +0000
commit65cef764ea6833c8abc10e5397c10541deb6b7b0 (patch)
tree275cfc1bee454411640b5d296c5d087cbae1df3c
parent466933731d5803b3c50227d1c2ddf236603fc7eb (diff)
downloadFreeBSD-src-65cef764ea6833c8abc10e5397c10541deb6b7b0.zip
FreeBSD-src-65cef764ea6833c8abc10e5397c10541deb6b7b0.tar.gz
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.
-rw-r--r--sys/i386/i386/userconfig.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/i386/i386/userconfig.c b/sys/i386/i386/userconfig.c
index 06a4065..fbb6d7b 100644
--- a/sys/i386/i386/userconfig.c
+++ b/sys/i386/i386/userconfig.c
@@ -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;
}
OpenPOWER on IntegriCloud