Add a patch that better detects the dos partitions.

This commit is contained in:
Joel Andres Granados Moreno 2008-05-29 17:26:02 +00:00
parent 2667a15ebc
commit f6edd98c3a
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index e513a05..81d8600 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -192,14 +192,16 @@ msdos_probe (const PedDevice *dev)
if (PED_LE16_TO_CPU (part_table->magic) != MSDOS_MAGIC)
goto probe_fail;
- /* if this is a FAT fs, fail here. Note that the Smart Boot Manager
- * Loader (SBML) signature indicates a partition table, not a file
- * system.
+ /* If this is a FAT fs, fail here. Checking for the FAT signature
+ * has some false positives; instead, do what the Linux kernel does
+ * and ensure that each partition has a boot indicator that is
+ * either 0 or 0x80.
*/
- if ((!strncmp (part_table->boot_code + 0x36, "FAT", 3)
- && strncmp (part_table->boot_code + 0x40, "SBML", 4) != 0)
- || !strncmp (part_table->boot_code + 0x52, "FAT", 3))
- goto probe_fail;
+ for (i = 0; i < 4; i++) {
+ if (part_table->partitions[i].boot_ind != 0
+ && part_table->partitions[i].boot_ind != 0x80)
+ goto probe_fail;
+ }
/* If this is a GPT disk, fail here */
for (i = 0; i < 4; i++) {

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 1.8.8
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -17,6 +17,7 @@ Patch3: %{name}-1.8.8-manpage.patch
Patch4: %{name}-1.8.8-gcc-4.3.patch
Patch5: %{name}-1.8.8-nofixgpt.patch
Patch6: %{name}-1.8.8-alpha.patch
Patch7: %{name}-1.8.8-dospartrec.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -60,6 +61,7 @@ Parted library, you need to install this package.
%patch4 -p1 -b .gcc43
%patch5 -p1 -b .nofixgpt
%patch6 -p1 -b .alpha
%patch7 -p1 -b .dospartrec
%build
%configure --enable-device-mapper --enable-selinux --disable-static
@ -117,6 +119,9 @@ fi
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
%changelog
* Thu May 29 2008 Joel Granados <jgranado@redhat.com> - 1.8.8-6
- Do a better job at recognizing the dos partition. (#246423)
* Thu Apr 10 2008 David Cantrell <dcantrell@redhat.com> - 1.8.8-5
- Allow RAID or LVM partition types on BSD disklabels.
(jay.estabrook AT hp.com, #427114)