summaryrefslogtreecommitdiffstats
path: root/perl-install/resize_fat/main.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/resize_fat/main.pm')
-rw-r--r--perl-install/resize_fat/main.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm
index 0c94586ec..c3eee9381 100644
--- a/perl-install/resize_fat/main.pm
+++ b/perl-install/resize_fat/main.pm
@@ -41,12 +41,17 @@ sub new($$$) {
my ($type, $device, $fs_name) = @_;
my $fs = { device => $device, fs_name => $fs_name } ;
- resize_fat::io::open($fs);
- resize_fat::boot_sector::read($fs);
- $resize_fat::isFAT32 and eval { resize_fat::info_sector::read($fs) };
- resize_fat::fat::read($fs);
- resize_fat::any::flag_clusters($fs);
-
+ eval {
+ resize_fat::io::open($fs);
+ resize_fat::boot_sector::read($fs);
+ $resize_fat::isFAT32 and eval { resize_fat::info_sector::read($fs) };
+ resize_fat::fat::read($fs);
+ resize_fat::any::flag_clusters($fs);
+ };
+ if ($@) {
+ close $fs->{fd};
+ die;
+ }
bless $fs, $type;
}