summaryrefslogtreecommitdiff
path: root/sbin/fdisk/part.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-04-28 13:22:20 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-04-28 13:22:20 +0000
commitb81982b7a9e68ffbd1fbb4a9c090234b9e994780 (patch)
tree20611ab6c947920f0d16a58536fe73235884f6d0 /sbin/fdisk/part.c
parent031d62adead7fdc94fb3090936b0c16cc7429b27 (diff)
Convert the internal GPT partition entries into host-endian form
on input/initialization and back to little-endian when writing to disk. Easier to read the code when letoh*() and uuid_[enc|dec]_* invocations are minimized. No intentional functional change. ok jmatthew@
Diffstat (limited to 'sbin/fdisk/part.c')
-rw-r--r--sbin/fdisk/part.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c
index 50671fa30a3..ca5f00712c2 100644
--- a/sbin/fdisk/part.c
+++ b/sbin/fdisk/part.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.c,v 1.123 2022/04/18 17:32:16 krw Exp $ */
+/* $OpenBSD: part.c,v 1.124 2022/04/28 13:22:19 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -190,7 +190,7 @@ PRT_protected_guid(const struct uuid *uuid)
char *efistr = NULL, *str = NULL;
const char *typename;
int rslt = 0;
- unsigned int i;
+ unsigned int i, pn;
uint32_t status;
uuid_dec_be(gpt_uuid_efi_system, &uuid_efi_system);
@@ -208,8 +208,8 @@ PRT_protected_guid(const struct uuid *uuid)
if (strncmp(str, efistr, UUID_STR_LEN) == 0) {
/* Look for partitions indicating a need to preserve EFI Sys */
- for (i = 0; i < gh.gh_part_num; i++) {
- typename = PRT_uuid_to_typename(&gp[i].gp_type);
+ for (pn = 0; pn < gh.gh_part_num; pn++) {
+ typename = PRT_uuid_to_typename(&gp[pn].gp_type);
if (strncmp(typename, "APFS ", 5))
continue;
rslt = -1;