Date: Fri, 9 Mar 2012 18:15:38 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r232736 - projects/bigbb/sys/boot/i386/boot2 Message-ID: <201203091815.q29IFcCZ019047@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Fri Mar 9 18:15:38 2012 New Revision: 232736 URL: http://svn.freebsd.org/changeset/base/232736 Log: Initialize opts and kname correctly. BSS for boot2 does not auto-clear. See r219452 for more information. Reported by: jhb Modified: projects/bigbb/sys/boot/i386/boot2/boot2.c Modified: projects/bigbb/sys/boot/i386/boot2/boot2.c ============================================================================== --- projects/bigbb/sys/boot/i386/boot2/boot2.c Fri Mar 9 17:47:59 2012 (r232735) +++ projects/bigbb/sys/boot/i386/boot2/boot2.c Fri Mar 9 18:15:38 2012 (r232736) @@ -129,8 +129,8 @@ static struct dsk { int init; } dsk; static char cmd[512], cmddup[512], knamebuf[1024]; -static const char *kname; -static uint32_t opts; +static const char *kname = 0; +static uint32_t opts = 0; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; @@ -223,6 +223,7 @@ main(void) { uint8_t autoboot; ino_t ino; + size_t nbyte; dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); v86.ctl = V86_FLAGS; @@ -239,8 +240,10 @@ main(void) autoboot = 1; if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) - fsread(ino, cmd, sizeof(cmd) - 1); + (ino = lookup(PATH_DOTCONFIG))) { + nbyte = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[nbyte] = '\0'; + } if (*cmd) { memcpy(cmddup, cmd, sizeof(cmd));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203091815.q29IFcCZ019047>