summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-10-02 16:22:26 +0000
committermsmith <msmith@FreeBSD.org>1998-10-02 16:22:26 +0000
commit9844efc6b7fb0a3c2933de8d19143a12940308f2 (patch)
treeccaeb19c4c248eb70b2baabbd99aaa93237c1694 /sys/boot/common
parenta9d48ca05933036fc90583cb3b588beecaa467b7 (diff)
downloadFreeBSD-src-9844efc6b7fb0a3c2933de8d19143a12940308f2.zip
FreeBSD-src-9844efc6b7fb0a3c2933de8d19143a12940308f2.tar.gz
boot.c
Increase the robustness of the "is it time to boot yet" test; if the time skipped the "when" time, we would miss it. Don't spin in an endless loop if we don't find the first possible kernel suggested. When we run out, don't try to load an empty kernel name. load_aout.c printf format warnings
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/boot.c12
-rw-r--r--sys/boot/common/load_aout.c6
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c
index 85b5741..e0ea678 100644
--- a/sys/boot/common/boot.c
+++ b/sys/boot/common/boot.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: boot.c,v 1.2 1998/08/31 21:10:42 msmith Exp $
+ * $Id: boot.c,v 1.3 1998/09/28 22:03:01 peter Exp $
*/
/*
@@ -174,7 +174,7 @@ autoboot(int delay, char *prompt)
break;
}
ntime = time(NULL);
- if (ntime == when) {
+ if (ntime >= when) {
yes = 1;
break;
}
@@ -214,8 +214,10 @@ getbootfile(int try)
if ((spec = getenv("bootfile")) == NULL)
spec = default_bootfiles;
- while ((try > 0) && (spec != NULL))
+ while ((try > 0) && (spec != NULL)) {
spec = strchr(spec, ',');
+ try--;
+ }
if (spec != NULL) {
if ((ep = strchr(spec, ',')) != NULL) {
len = ep - spec;
@@ -226,6 +228,10 @@ getbootfile(int try)
strncpy(name, spec, len);
name[len] = 0;
}
+ if (name[0] == 0) {
+ free(name);
+ name = NULL;
+ }
return(name);
}
diff --git a/sys/boot/common/load_aout.c b/sys/boot/common/load_aout.c
index 92c65a43..335adeb 100644
--- a/sys/boot/common/load_aout.c
+++ b/sys/boot/common/load_aout.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: load_aout.c,v 1.6 1998/09/26 10:51:38 dfr Exp $
+ * $Id: load_aout.c,v 1.7 1998/09/30 19:26:23 peter Exp $
*/
#include <sys/param.h>
@@ -212,7 +212,7 @@ aout_loadimage(int fd, vm_offset_t loadaddr, struct exec *ehdr, int kernel)
addr += sizeof(ehdr->a_syms);
/* symbol table */
- printf("symbols=[0x%lx+0x%lx", sizeof(ehdr->a_syms), ehdr->a_syms);
+ printf("symbols=[0x%x+0x%lx", sizeof(ehdr->a_syms), ehdr->a_syms);
if (archsw.arch_readin(fd, addr, ehdr->a_syms) != ehdr->a_syms)
return(0);
addr += ehdr->a_syms;
@@ -222,7 +222,7 @@ aout_loadimage(int fd, vm_offset_t loadaddr, struct exec *ehdr, int kernel)
archsw.arch_copyin(&ss, addr, sizeof(ss));
addr += sizeof(ss);
ss -= sizeof(ss);
- printf("+0x%lx+0x%x]", sizeof(ss), ss);
+ printf("+0x%x+0x%x]", sizeof(ss), ss);
if (archsw.arch_readin(fd, addr, ss) != ss)
return(0);
printf(" \n");
OpenPOWER on IntegriCloud