summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authormarco <marco@openbsd.org>2007-03-30 20:12:28 +0000
committermarco <marco@openbsd.org>2007-03-30 20:12:28 +0000
commite7166ddcf32b62353770e73aa278d5a6e856b709 (patch)
tree26dad65bba1f8622ed7f72cce1c95d886063447e /sys/dev/softraid.c
parentDon't assume 'run' to be executable, pointed out and okay deraadt@ (diff)
downloadwireguard-openbsd-e7166ddcf32b62353770e73aa278d5a6e856b709.tar.xz
wireguard-openbsd-e7166ddcf32b62353770e73aa278d5a6e856b709.zip
Calculate proper offset in partition table.
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 4ece30730e6..1bafcea170f 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.9 2007/03/27 04:05:22 marco Exp $ */
+/* $OpenBSD: softraid.c,v 1.10 2007/03/30 20:12:28 marco Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -919,7 +919,7 @@ sr_parse_chunks(struct sr_softc *sc, char *lst, struct sr_chunk_head *cl)
/* get partition size */
ss = name[strlen(name) - 1];
ch_entry->src_meta.scm_size =
- label.d_partitions['a' - ss].p_size;
+ label.d_partitions[ss - 'a'].p_size;
if (ch_entry->src_meta.scm_size == 0) {
printf("%s: %s partition size = 0\n",
DEVNAME(sc), name);
@@ -927,9 +927,10 @@ sr_parse_chunks(struct sr_softc *sc, char *lst, struct sr_chunk_head *cl)
}
/* make sure the partition is of the right type */
- if (label.d_partitions['a' - ss].p_fstype != FS_RAID) {
- printf("%s: %s partition not of type RAID\n",
- DEVNAME(sc), name);
+ if (label.d_partitions[ss - 'a'].p_fstype != FS_RAID) {
+ printf("%s: %s partition not of type RAID (%d)\n",
+ DEVNAME(sc), name,
+ label.d_partitions[ss - 'a'].p_fstype);
goto unlock;
}