summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-02-13 16:14:05 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-02-13 16:14:05 +0000
commit844d7ff40403238d8a36b9344a7c9c1501a151bf (patch)
treea7c4c87da9281b143e4474e3e7d7b56a82e91ea2 /perl-install
parent3a16cb5d91400c6af65ccdcc1cf4468eddaf8100 (diff)
downloaddrakx-backup-do-not-use-844d7ff40403238d8a36b9344a7c9c1501a151bf.tar
drakx-backup-do-not-use-844d7ff40403238d8a36b9344a7c9c1501a151bf.tar.gz
drakx-backup-do-not-use-844d7ff40403238d8a36b9344a7c9c1501a151bf.tar.bz2
drakx-backup-do-not-use-844d7ff40403238d8a36b9344a7c9c1501a151bf.tar.xz
drakx-backup-do-not-use-844d7ff40403238d8a36b9344a7c9c1501a151bf.zip
diskdrake: don't crash on invalid partition table
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/c/stuff.xs.pl72
-rw-r--r--perl-install/install/NEWS2
3 files changed, 44 insertions, 31 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index ca458cfce..8652ab9c2 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,6 +1,7 @@
- diskdrake:
o allow resizing on lvm for mounted ext3/4 and not mounted xfs
o use a list instead of combo in the partition type selection window
+ o don't crash on invalid partition table
Version 11.86 - 12 February 2009
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index bf8e35bc1..519899bd1 100644
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -519,11 +519,14 @@ const char *
get_disk_type(char * device_path)
CODE:
PedDevice *dev = ped_device_get(device_path);
+ RETVAL = NULL;
if(dev) {
PedDisk* disk = ped_disk_new(dev);
- RETVAL = disk->type->name;
- ped_disk_destroy(disk);
- } else RETVAL = NULL;
+ if(disk) {
+ RETVAL = disk->type->name;
+ ped_disk_destroy(disk);
+ }
+ }
OUTPUT:
RETVAL
@@ -590,13 +593,16 @@ int
disk_delete_all(char * device_path)
CODE:
PedDevice *dev = ped_device_get(device_path);
+ RETVAL = 0;
if(dev) {
PedDisk* disk = ped_disk_new(dev);
- RETVAL = ped_disk_delete_all(disk);
- if(RETVAL)
- RETVAL = ped_disk_commit(disk);
- ped_disk_destroy(disk);
- } else RETVAL = 0;
+ if(disk) {
+ RETVAL = ped_disk_delete_all(disk);
+ if(RETVAL)
+ RETVAL = ped_disk_commit(disk);
+ ped_disk_destroy(disk);
+ }
+ }
OUTPUT:
RETVAL
@@ -607,18 +613,20 @@ disk_del_partition(char * device_path, int part_number)
RETVAL = 0;
if(dev) {
PedDisk* disk = ped_disk_new(dev);
- PedPartition* part = ped_disk_get_partition(disk, part_number);
- if(!part) {
- printf("disk_del_partition: failed to find partition\n");
- } else {
- RETVAL=ped_disk_delete_partition(disk, part);
- if(RETVAL) {
- RETVAL = ped_disk_commit(disk);
+ if(disk) {
+ PedPartition* part = ped_disk_get_partition(disk, part_number);
+ if(!part) {
+ printf("disk_del_partition: failed to find partition\n");
} else {
- printf("del_partition failed\n");
+ RETVAL=ped_disk_delete_partition(disk, part);
+ if(RETVAL) {
+ RETVAL = ped_disk_commit(disk);
+ } else {
+ printf("del_partition failed\n");
+ }
}
+ ped_disk_destroy(disk);
}
- ped_disk_destroy(disk);
}
OUTPUT:
RETVAL
@@ -630,21 +638,23 @@ disk_add_partition(char * device_path, double start, double length, const char *
RETVAL=0;
if(dev) {
PedDisk* disk = ped_disk_new(dev);
- PedGeometry* geom = ped_geometry_new(dev, (long long)start, (long long)length);
- PedPartition* part = ped_partition_new (disk, PED_PARTITION_NORMAL, ped_file_system_type_get(fs_type), (long long)start, (long long)start+length-1);
- PedConstraint* constraint = ped_constraint_new_from_max(geom);
- if(!part) {
- printf("ped_partition_new failed\n");
- } else
- RETVAL = ped_disk_add_partition (disk, part, constraint);
- if(RETVAL) {
- RETVAL = ped_disk_commit(disk);
- } else {
- printf("add_partition failed\n");
+ if(disk) {
+ PedGeometry* geom = ped_geometry_new(dev, (long long)start, (long long)length);
+ PedPartition* part = ped_partition_new (disk, PED_PARTITION_NORMAL, ped_file_system_type_get(fs_type), (long long)start, (long long)start+length-1);
+ PedConstraint* constraint = ped_constraint_new_from_max(geom);
+ if(!part) {
+ printf("ped_partition_new failed\n");
+ } else
+ RETVAL = ped_disk_add_partition (disk, part, constraint);
+ if(RETVAL) {
+ RETVAL = ped_disk_commit(disk);
+ } else {
+ printf("add_partition failed\n");
+ }
+ ped_geometry_destroy(geom);
+ ped_constraint_destroy(constraint);
+ ped_disk_destroy(disk);
}
- ped_geometry_destroy(geom);
- ped_constraint_destroy(constraint);
- ped_disk_destroy(disk);
}
OUTPUT:
RETVAL
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index 63478e389..eb6569c68 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,3 +1,5 @@
+- don't crash on invalid partition table
+
Version 11.86 - 12 February 2009
- upload a fully updated version