summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/dos.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table/dos.pm')
-rw-r--r--perl-install/partition_table/dos.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 00b3c531e..2cd6fe311 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -1,4 +1,4 @@
-package partition_table::dos; # $Id: dos.pm 228577 2007-09-19 15:34:17Z pixel $
+package partition_table::dos; # $Id: dos.pm 263707 2009-11-26 13:26:41Z pterjan $
use diagnostics;
use strict;
@@ -220,6 +220,19 @@ sub read_one {
sysread $F, $tmp, length $magic or die "error reading magic number on disk $hd->{device}";
$tmp eq $magic or die "bad magic number on disk $hd->{device}";
+ if(c::get_disk_type($hd->{file}) ne "msdos") {
+ # libparted may have ignored it because of overlapping partitions or other error
+ # while it is actually a partition table.
+ $hd->{fs_type_from_magic} and die "unpartitionned disk";
+ my $primary = partition_table::raw::pt_info_to_primary($hd, [ @pt ]);
+ foreach my $i (@{$primary->{normal}}) {
+ if (($i->{active} && $i->{active} != 0x80) ||
+ ($hd->{totalsectors} && $i->{start} > $hd->{totalsectors})) {
+ die "Invalid DOS partition table";
+ }
+ }
+ }
+
[ @pt ];
}