From b33befb035925ce5b438f76024bb0f61447b0302 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sat, 15 May 2021 15:59:16 +0000 Subject: Add missing MBR_protective_mbr() check when writing edited GPT. No intentional functional change. --- sbin/fdisk/cmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sbin') diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 8ba7f5e6fd3..0c90654cd0c 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.103 2021/05/14 15:31:01 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.104 2021/05/15 15:59:15 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -410,7 +410,7 @@ int Xwrite(char *args, struct mbr *mbr) { struct dos_mbr dos_mbr; - int i, n; + int efi, i, n; for (i = 0, n = 0; i < NDOSPART; i++) if (mbr->part[i].id == 0xA6) @@ -431,7 +431,8 @@ Xwrite(char *args, struct mbr *mbr) if (letoh64(gh.gh_sig) == GPTSIGNATURE) { printf("Writing GPT.\n"); - if (GPT_write() == -1) { + efi = MBR_protective_mbr(mbr); + if (efi == -1 || GPT_write() == -1) { warn("error writing GPT"); return (CMD_CONT); } -- cgit v1.2.3