[gparted] Clear libparted kernel re-read messages when scanning devices



commit 1ef489fcd8db8b84276881a04a3076fdbbc57e6c
Author: Curtis Gedak <gedakc gmail com>
Date:   Wed Dec 9 13:16:18 2009 -0700

    Clear libparted kernel re-read messages when scanning devices
    
    When calling commit_to_os() with newer Linux kernels,
    parted-1.9.0, and at least one partition mounted on the device,
    the following error message is displayed:
    
        The kernel was unable to re-read the partition table on
        /dev/sda (Device or resource busy).  This means Linux won't
        know anything about the modifications you made until you
        reboot.  You should reboot your computer before doing
        anything with /dev/sda.
    
    If this message is not cleared then it will remain in the
    libparted_message array and could potentially be displayed along
    with an error message for a subsequent scanned disk device.

 src/GParted_Core.cc |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index c48d084..eb9bb1a 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -308,7 +308,12 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
 				set_used_sectors( temp_device .partitions ) ;
 			
 				if ( temp_device .highest_busy )
+				{
 					temp_device .readonly = ! commit_to_os( 1 ) ;
+					//Clear libparted messages.  Typically these are:
+					//  The kernel was unable to re-read the partition table...
+					libparted_messages .clear() ;
+				}
 			}
 			//harddisk without disklabel
 			else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]