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)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to