[PATCH 1/2] gpt: clean-up wrt write_back (no semantic change)

Jim Meyering meyering at redhat.com
Fri Feb 12 13:59:04 UTC 2010


* libparted/labels/gpt.c (gpt_read): Initialize write_back to 0
once again, and set it to 1 on the sole path that requires that.
---
 libparted/labels/gpt.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 48d580e..40ee0c1 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -898,7 +898,7 @@ gpt_read (PedDisk *disk)
   GPTDiskData *gpt_disk_data = disk->disk_specific;
   int i;
 #ifndef DISCOVER_ONLY
-  int write_back = 1;
+  int write_back = 0;
 #endif

   ped_disk_delete_all (disk);
@@ -949,16 +949,12 @@ gpt_read (PedDisk *disk)
             case PED_EXCEPTION_FIX:
               ptt_clear_sectors (disk->dev,
                                  PED_LE64_TO_CPU (primary_gpt->AlternateLBA), 1);
+              write_back = 1;
               break;
             default:
-              write_back = 0;
               break;
             }
         }
-      else
-	{
-	  write_back = 0;
-	}
 #endif /* !DISCOVER_ONLY */
       gpt = primary_gpt;
       pth_free (backup_gpt);
@@ -984,7 +980,6 @@ gpt_read (PedDisk *disk)
         goto error_free_gpt;

       gpt = primary_gpt;
-      write_back = 0;
     }
   else /* !primary_gpt && backup_gpt */
     {
@@ -997,7 +992,6 @@ gpt_read (PedDisk *disk)
         goto error_free_gpt;

       gpt = backup_gpt;
-      write_back = 0;
     }
   backup_gpt = NULL;
   primary_gpt = NULL;
--
1.7.0.rc2.170.gbc565




More information about the parted-devel mailing list