Date: Sat, 29 Oct 2011 17:29:00 +0000 (UTC) From: John-Mark Gurney <jmg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r226907 - head/sbin/fdisk Message-ID: <201110291729.p9THT091026125@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmg Date: Sat Oct 29 17:28:59 2011 New Revision: 226907 URL: http://svn.freebsd.org/changeset/base/226907 Log: error if /boot/mbr is empty... This can happen on a system like arm that doesn't have a /boot/mbr, and you touch it to get past the previous error message... MFC after: 1 week Modified: head/sbin/fdisk/fdisk.c Modified: head/sbin/fdisk/fdisk.c ============================================================================== --- head/sbin/fdisk/fdisk.c Sat Oct 29 16:38:04 2011 (r226906) +++ head/sbin/fdisk/fdisk.c Sat Oct 29 17:28:59 2011 (r226907) @@ -513,6 +513,8 @@ init_boot(void) if ((fdesc = open(fname, O_RDONLY)) == -1 || fstat(fdesc, &sb) == -1) err(1, "%s", fname); + if (sb.st_size == 0) + errx(1, "%s is empty, must not be.", fname); if ((mboot.bootinst_size = sb.st_size) % secsize != 0) errx(1, "%s: length must be a multiple of sector size", fname); if (mboot.bootinst != NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110291729.p9THT091026125>