summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon L. B. Nielsen <simon@FreeBSD.org>2006-06-18 22:02:22 +0000
committerSimon L. B. Nielsen <simon@FreeBSD.org>2006-06-18 22:02:22 +0000
commitaee85526aaa3bcd0bdf6c5720bb496caeb1da76f (patch)
tree0778e7f8ccdf761258d60d08edadb1b739a619ad
parent274ede62a872185bab3ceba8acbf19b91ea4e395 (diff)
Notes
-rw-r--r--sbin/fdisk/fdisk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index d0b12b766db1..142cf134ab9c 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -317,7 +317,8 @@ main(int argc, char *argv[])
/* (abu)use mboot.bootinst to probe for the sector size */
if ((mboot.bootinst = malloc(MAX_SEC_SIZE)) == NULL)
err(1, "cannot allocate buffer to determine disk sector size");
- read_disk(0, mboot.bootinst);
+ if (read_disk(0, mboot.bootinst) == -1)
+ errx(1, "could not detect sector size");
free(mboot.bootinst);
mboot.bootinst = NULL;
@@ -811,6 +812,8 @@ get_params()
error = ioctl(fd, DIOCGSECTORSIZE, &u);
if (error != 0 || u == 0)
u = 512;
+ else
+ secsize = u;
error = ioctl(fd, DIOCGMEDIASIZE, &o);
if (error == 0) {
@@ -1395,7 +1398,7 @@ get_rootdisk(void)
if (statfs("/", &rootfs) == -1)
err(1, "statfs(\"/\")");
- if ((rv = regcomp(&re, "^(/dev/[a-z]+[0-9]+)([sp][0-9]+)?[a-h]?$",
+ if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$",
REG_EXTENDED)) != 0)
errx(1, "regcomp() failed (%d)", rv);
if ((rv = regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) != 0)