[parted-devel] Infinite loop during 'print all': patch

Debarshi 'Rishi' Ray debarshi.ray at gmail.com
Wed Nov 22 19:54:59 CET 2006


Parted 1.8.0-final suffers from a bug where doing a 'print all'
results in an infinite loop, with every alternate device, which was
detected, being skipped.

Please find attached a patch to fix this. Thanks to Otavio for his the
help in verifying this problem.

Happy hacking,
Debarshi
-- 
I only work when I am not doing any assignments.
-------------- next part --------------
From c133999ed7798b12a1a04f3e9c50c471c8312616 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?=E0=A6=A6=E0=A7=87=E0=A6=AC=E0=A6=B0=E0=A7=8D=E0=A6=B7=E0=A6=BF_=E0=A6=B0=E0=A6=BE=E0=A7=9F?= <rishi at Sunflower.(none)>
Date: Thu, 23 Nov 2006 00:21:24 +0000
Subject: Fix infinite loop during 'print all'.

---
 parted/parted.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index df09d31..4c2c1c3 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1236,15 +1236,13 @@ do_print (PedDevice** dev)
 
         if (has_all_arg) {
                 int first_device;
-                PedDevice *current_dev;
+                PedDevice *current_dev = NULL;
 
                 ped_device_probe_all();
-                current_dev = NULL;
 
                 while ((current_dev = ped_device_get_next(current_dev))) {
                         do_print (&current_dev);
                         printf ("\n");
-                        current_dev = ped_device_get_next (current_dev);
                 }    
 
                 return 1;
-- 
1.4.2.4


More information about the parted-devel mailing list