]>
Commit | Line | Data |
---|---|---|
77814ee8 JB |
1 | --- xen-4.18.1/tools/pygrub/src/pygrub.orig 2024-03-18 09:27:49.000000000 +0100 |
2 | +++ xen-4.18.1/tools/pygrub/src/pygrub 2024-04-22 20:02:33.313097814 +0200 | |
3 | @@ -256,6 +256,7 @@ def get_partition_offsets(file): | |
ed22e3b5 JR |
4 | fd = os.open(file, os.O_RDONLY) |
5 | buf = os.read(fd, 512) | |
bf4f47e8 | 6 | os.close(fd) |
ed22e3b5 JR |
7 | + offzerocount = 0 |
8 | for poff in (446, 462, 478, 494): # partition offsets | |
9 | ||
10 | # MBR contains a 16 byte descriptor per partition | |
77814ee8 JB |
11 | @@ -265,6 +266,7 @@ def get_partition_offsets(file): |
12 | ||
ed22e3b5 JR |
13 | # offset == 0 implies this partition is not enabled |
14 | if offset == 0: | |
15 | + offzerocount += 1 | |
16 | continue | |
17 | ||
18 | if type == FDISK_PART_SOLARIS or type == FDISK_PART_SOLARIS_OLD: | |
77814ee8 | 19 | @@ -290,6 +292,9 @@ def get_partition_offsets(file): |
e87157b6 JR |
20 | # (e.g. grubs) may contain the same signature. |
21 | if not part_offs: part_offs = [0] | |
ed22e3b5 JR |
22 | |
23 | + if offzerocount == 4: | |
24 | + # Might be a grub boot sector pretending to be an MBR | |
25 | + part_offs.append(0) | |
26 | return part_offs | |
27 | ||
28 | class GrubLineEditor(curses.textpad.Textbox): |