summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-10-09 18:29:22 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-10-09 18:29:22 +0000
commit743a57354cbb7fe0c0cfb38cca5d69a35d0f0f3d (patch)
tree1f2ec4603a7cdc1ba8aa8e67acbdb1ac7f80b38a
parentc9b7d8ff9d23766663d59465e4025bb9278c2f10 (diff)
downloadparted-743a57354cbb7fe0c0cfb38cca5d69a35d0f0f3d.tar.gz
* disk.c (ped_unregister_disk_type): Handle instances where disk_types
== NULL and the given type is not in the list of registered disk types (from Debarshi Ray). git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@844 2d424fd7-7fe2-0310-af74-8bc65edeb173
-rw-r--r--AUTHORS2
-rw-r--r--libparted/ChangeLog5
-rw-r--r--libparted/disk.c4
3 files changed, 10 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index 4ac1ccb..c6ad983 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -222,3 +222,5 @@ Olaf Hering <olh@suse.de>
Debarshi Ray <debarshi.ray@gmail.com>
* Display disk model and transport type in parted(8).
+ * Handle ped_unregister_disk_type() cases when disk_types is not
+ NULL and instances where the specified type is not registered.
diff --git a/libparted/ChangeLog b/libparted/ChangeLog
index 14e3087..9648d62 100644
--- a/libparted/ChangeLog
+++ b/libparted/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-09 David Cantrell <dcantrell@redhat.com>
+ * disk.c (ped_unregister_disk_type): Handle instances where disk_types
+ == NULL and the given type is not in the list of registered disk types
+ (from Debarshi Ray).
+
2006-10-06 David Cantrell <dcantrell@redhat.com>
* arch/linux.c: Change __GNU_SOURCE define to _GNU_SOURCE (only one
underscore at the beginning). Fixes problem with certain systems
diff --git a/libparted/disk.c b/libparted/disk.c
index 262c33e..c17488b 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -80,12 +80,14 @@ void ped_unregister_disk_type (PedDiskType* type)
PedDiskType* walk;
PedDiskType* last = NULL;
+ PED_ASSERT (disk_types != NULL, return);
PED_ASSERT (type != NULL, return);
- for (walk = disk_types; walk != NULL; last = walk, walk = walk->next) {
+ for (walk = disk_types; walk; last = walk, walk = walk->next) {
if (walk == type) break;
}
+ PED_ASSERT (walk != NULL, return);
if (last)
((struct _PedDiskType*) last)->next = type->next;
else