summaryrefslogtreecommitdiff
path: root/sbin/disklabel
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-05-13 01:31:59 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-05-13 01:31:59 +0000
commite4c35052dac3c84399df1348da29211c656d8e81 (patch)
tree65a7379b1cae1697bb0e054f18ed9b964c343a71 /sbin/disklabel
parent8541d2729a9dc2d75c99c7e7523f5e946c40a6f7 (diff)
Set D_VENDOR when spoofing a label on archs that use D_VENDOR when
reading the native disklabel. This ensures cylinder alignment. Fix disklabel to do cylinder alignment arithmetic correctly in -A mode. Worked by accident before, since the code was protected by D_VENDOR, which wasn't being set. ok deraadt@
Diffstat (limited to 'sbin/disklabel')
-rw-r--r--sbin/disklabel/editor.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index c6383404481..6039a04d8aa 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.207 2009/05/12 00:54:48 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.208 2009/05/13 01:31:58 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.207 2009/05/12 00:54:48 krw Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.208 2009/05/13 01:31:58 krw Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -610,9 +610,9 @@ cylinderalign:
#ifdef SUN_CYLCHECK
if (lp->d_flags & D_VENDOR) {
/* Align chunk to cylinder boundaries. */
- chunksize -= cylsecs - chunkstart % cylsecs;
chunksize -= chunksize % cylsecs;
- chunkstart += cylsecs - chunkstart % cylsecs;
+ chunkstart = ((chunkstart + cylsecs - 1) / cylsecs) *
+ cylsecs;
}
#endif
/* See if partition can fit into chunk. */