summaryrefslogtreecommitdiffstats
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>2011-10-29 17:28:59 +0000
committerjmg <jmg@FreeBSD.org>2011-10-29 17:28:59 +0000
commit1c5b4943520698d0267d05fb6b60a3ee8f6a5f86 (patch)
treee2f8eae6ad2267d0a80ffa4bb244b351d17678f9 /sbin/fdisk
parentca5e2c25d4f63dac76001083afccd6cfd9573962 (diff)
downloadFreeBSD-src-1c5b4943520698d0267d05fb6b60a3ee8f6a5f86.zip
FreeBSD-src-1c5b4943520698d0267d05fb6b60a3ee8f6a5f86.tar.gz
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
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/fdisk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index ba1ee00..49c5724 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -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)
OpenPOWER on IntegriCloud