Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 1999 03:15:01 +0900 (JST)
From:      dcs@newsguy.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Cc:        dcs@newsguy.com
Subject:   kern/9371: Boot parsing problem
Message-ID:  <199901071815.DAA02517@local.ocn.ne.jp>

next in thread | raw e-mail | index | archive | help

>Number:         9371
>Category:       kern
>Synopsis:       Getopt does not get reinitialized in the boot parser
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan  7 10:20:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Daniel C. Sobral
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	Three stage boot's loader.

>Description:

	No builtin command resets getopt before using it, causing
problems in case a wrong option was given previously, and no option
is given to the next command.

>How-To-Repeat:

	Boot.
	Type:
ls -?
load /kernel

>Fix:

	Apply the following fixes:

	
--- sys/boot/common/commands.c.orig	Fri Jan  8 03:00:29 1999
+++ sys/boot/common/commands.c	Fri Jan  8 03:01:17 1999
@@ -299,6 +299,7 @@
     
     nl = 0;
     optind = 1;
+    optreset = 1;
     while ((ch = getopt(argc, argv, "n")) != -1) {
 	switch(ch) {
 	case 'n':
@@ -343,6 +344,7 @@
     timeout = -1;
     prompt = NULL;
     optind = 1;
+    optreset = 1;
     while ((c = getopt(argc, argv, "p:t:")) != -1) {
 	switch(c) {
 	    
@@ -394,6 +396,7 @@
     
     verbose = 0;
     optind = 1;
+    optreset = 1;
     while ((ch = getopt(argc, argv, "v")) != -1) {
 	switch(ch) {
 	case 'v':
--- sys/boot/common/ls.c.orig	Fri Jan  8 03:01:18 1999
+++ sys/boot/common/ls.c	Fri Jan  8 03:01:32 1999
@@ -70,6 +70,7 @@
     fd = -1;
     verbose = 0;
     optind = 1;
+    optreset = 1;
     while ((ch = getopt(argc, argv, "l")) != -1) {
 	switch(ch) {
 	case 'l':
--- sys/boot/common/module.c.orig	Fri Jan  8 03:01:32 1999
+++ sys/boot/common/module.c	Fri Jan  8 03:02:21 1999
@@ -72,6 +72,7 @@
     
     dofile = 0;
     optind = 1;
+    optreset = 1;
     typestr = NULL;
     while ((ch = getopt(argc, argv, "t:")) != -1) {
 	switch(ch) {
@@ -133,6 +134,7 @@
 
     verbose = 0;
     optind = 1;
+    optreset = 1;
     while ((ch = getopt(argc, argv, "v")) != -1) {
 	switch(ch) {
 	case 'v':
--- sys/boot/common/pnp.c.orig	Fri Jan  8 03:02:21 1999
+++ sys/boot/common/pnp.c	Fri Jan  8 03:02:34 1999
@@ -41,6 +41,7 @@
 
     verbose = 0;
     optind = 1;
+    optreset = 1;
     while ((ch = getopt(argc, argv, "v")) != -1) {
 	switch(ch) {
 	case 'v':

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901071815.DAA02517>