From dffee829e88c5a4510cd98e45d03993b694f842c Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 19 Mar 2015 22:48:58 +0000 Subject: When zapping the GPT at the end of the disk, don't use disk.size to get the location. disk.size is a 32 bit value for MBR use. Use DL_GETDSIZE(&dl) to get the real location even on 'big' disks. --- sbin/fdisk/cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 5821e1201fe..fc9fa34d30e 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.78 2015/03/18 14:46:59 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.79 2015/03/19 22:48:57 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -295,7 +295,7 @@ Xwrite(char *args, struct mbr *mbr) /* Make sure GPT doesn't get in the way. */ if (reinited) - MBR_zapgpt(fd, &dos_mbr, disk.size - 1); + MBR_zapgpt(fd, &dos_mbr, DL_GETDSIZE(&dl) - 1); /* Refresh in memory copy to reflect what was just written. */ MBR_parse(&dos_mbr, mbr->offset, mbr->reloffset, mbr); -- cgit v1.2.3