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
This commit is contained in:
John-Mark Gurney 2011-10-29 17:28:59 +00:00
parent 9157ad4b17
commit 469a1218c0

View File

@ -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)