summaryrefslogtreecommitdiff
path: root/sbin/fdisk/part.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-01-18 19:37:28 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-01-18 19:37:28 +0000
commitfd2f268521fe12d8ad44ced3b8f5dac258dc8af1 (patch)
tree185fd00cf87f6414c9ecb02054d8159823722241 /sbin/fdisk/part.c
parentdacea0567fdb028c8b160a5161c48d88a68bad43 (diff)
PRT_make() can just zap the destination dos_partition if the
source prt has prt_ns == 0 or prt_id == DOSPTYP_UNUSED. No functional change.
Diffstat (limited to 'sbin/fdisk/part.c')
-rw-r--r--sbin/fdisk/part.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c
index 3dd5ee8a701..f7525baa104 100644
--- a/sbin/fdisk/part.c
+++ b/sbin/fdisk/part.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.c,v 1.110 2021/10/18 20:27:32 krw Exp $ */
+/* $OpenBSD: part.c,v 1.111 2022/01/18 19:37:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -313,6 +313,11 @@ PRT_make(const struct prt *prt, const uint64_t lba_self, const uint64_t lba_firs
uint64_t off, t;
uint32_t ecyl, scyl;
+ if (prt->prt_ns == 0 || prt->prt_id == DOSPTYP_UNUSED) {
+ memset(dp, 0, sizeof(*dp));
+ return;
+ }
+
scyl = (prt->prt_scyl > 1023) ? 1023 : prt->prt_scyl;
ecyl = (prt->prt_ecyl > 1023) ? 1023 : prt->prt_ecyl;