forked from bottlerocket-os/bottlerocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0030-gpt-allow-repair-function-to-noop.patch
45 lines (38 loc) · 1.33 KB
/
0030-gpt-allow-repair-function-to-noop.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 661ed965cb87ede5c83956cc5710dbeeb97e4abf Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Tue, 20 Sep 2016 13:40:11 -0700
Subject: [PATCH] gpt: allow repair function to noop
Simplifies usage a little.
---
grub-core/commands/gptprio.c | 5 ++---
grub-core/lib/gpt.c | 4 ++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/grub-core/commands/gptprio.c b/grub-core/commands/gptprio.c
index 59bc4fd..b799faa 100644
--- a/grub-core/commands/gptprio.c
+++ b/grub-core/commands/gptprio.c
@@ -91,9 +91,8 @@ grub_find_next (const char *disk_name,
if (!gpt)
goto done;
- if (!grub_gpt_both_valid(gpt))
- if (grub_gpt_repair (dev->disk, gpt))
- goto done;
+ if (grub_gpt_repair (dev->disk, gpt))
+ goto done;
for (i = 0; (part = grub_gpt_get_partentry (gpt, i)) != NULL; i++)
{
diff --git a/grub-core/lib/gpt.c b/grub-core/lib/gpt.c
index 3e077c4..9bb1967 100644
--- a/grub-core/lib/gpt.c
+++ b/grub-core/lib/gpt.c
@@ -586,6 +586,10 @@ grub_gpt_repair (grub_disk_t disk, grub_gpt_t gpt)
{
grub_uint64_t backup_header, backup_entries;
+ /* Skip if there is nothing to do. */
+ if (grub_gpt_both_valid (gpt))
+ return GRUB_ERR_NONE;
+
grub_dprintf ("gpt", "repairing GPT for %s\n", disk->name);
if (disk->log_sector_size != gpt->log_sector_size)
--
2.21.3