summaryrefslogtreecommitdiff
path: root/sbin/disklabel
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-01-17 01:28:07 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-01-17 01:28:07 +0000
commit05c0f9246182dcfc09b92218170cd4316e2dd0d8 (patch)
tree3b2df658256bd383e3bbf8043cda842158a1ee63 /sbin/disklabel
parent7fc1814bc5d7dfadde70b149c606ccef42161779 (diff)
Avoid ffs fragsize < sector-size when 'a'dding a partition via the
editor. Use logic from calculating fragsize for an auto-allocated partition. Noted when trying to add a small ffs partition to a 4K sector device.
Diffstat (limited to 'sbin/disklabel')
-rw-r--r--sbin/disklabel/editor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index dcd734c47c7..f2c3b0d991c 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.262 2012/01/02 03:46:39 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.263 2012/01/17 01:28:06 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -891,7 +891,8 @@ editor_add(struct disklabel *lp, char *p)
if (get_offset(lp, partno) == 0 &&
get_size(lp, partno) == 0) {
- fragsize = 2048;
+ fragsize = (lp->d_secsize == DEV_BSIZE) ? 2048 :
+ lp->d_secsize;
new_size = DL_GETPSIZE(pp) * lp->d_secsize;
if (new_size > 128ULL * 1024 * 1024 * 1024)
fragsize *= 2;