]>
Commit | Line | Data |
---|---|---|
e87157b6 JR |
1 | diff -urNp -x '*.orig' xen-4.13.1.org/tools/pygrub/src/pygrub xen-4.13.1/tools/pygrub/src/pygrub |
2 | --- xen-4.13.1.org/tools/pygrub/src/pygrub 2021-03-25 22:42:14.797689878 +0100 | |
3 | +++ xen-4.13.1/tools/pygrub/src/pygrub 2021-03-25 22:42:15.517685792 +0100 | |
4 | @@ -129,6 +129,7 @@ def get_partition_offsets(file): | |
ed22e3b5 JR |
5 | fd = os.open(file, os.O_RDONLY) |
6 | buf = os.read(fd, 512) | |
bf4f47e8 | 7 | os.close(fd) |
ed22e3b5 JR |
8 | + offzerocount = 0 |
9 | for poff in (446, 462, 478, 494): # partition offsets | |
10 | ||
11 | # MBR contains a 16 byte descriptor per partition | |
e87157b6 | 12 | @@ -138,6 +139,7 @@ def get_partition_offsets(file): |
ed22e3b5 JR |
13 | |
14 | # offset == 0 implies this partition is not enabled | |
15 | if offset == 0: | |
16 | + offzerocount += 1 | |
17 | continue | |
18 | ||
19 | if type == FDISK_PART_SOLARIS or type == FDISK_PART_SOLARIS_OLD: | |
e87157b6 JR |
20 | @@ -163,6 +165,9 @@ def get_partition_offsets(file): |
21 | # (e.g. grubs) may contain the same signature. | |
22 | if not part_offs: part_offs = [0] | |
ed22e3b5 JR |
23 | |
24 | + if offzerocount == 4: | |
25 | + # Might be a grub boot sector pretending to be an MBR | |
26 | + part_offs.append(0) | |
27 | return part_offs | |
28 | ||
29 | class GrubLineEditor(curses.textpad.Textbox): |