From 810b218bcd715400a708171ee596e80570c59fb4 Mon Sep 17 00:00:00 2001 From: krw Date: Sat, 15 May 2021 15:59:15 +0000 Subject: [PATCH] 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(-) 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); } -- 2.20.1