when the libary of an optional filesystem (atm only reiserfs) wasn't

* src/Device.cc: when the libary of an optional filesystem (atm only reiserfs) wasn't installed, every scan printed an error
in the console (df couldn't find the partition listed). Fixed by checking if partition is busy before using df.
This commit is contained in:
Bart Hakvoort 2004-10-16 20:27:28 +00:00
parent 58cb2ad6ec
commit d127dfa983
2 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2004-10-16 Bart Hakvoort <gparted@users.sf.net>
* src/Device.cc: when the libary of an optional filesystem (atm only reiserfs) wasn't installed, every scan printed an error
in the console (df couldn't find the partition listed). Fixed by checking if partition is busy before using df.
2004-10-16 Bart Hakvoort <gparted@users.sf.net>
* src/Dialog_Progress.cc: changed dialogwidth from 500 to 600 pixels. (icw certain languages the operation didn't fit)

View File

@ -539,19 +539,22 @@ Sector Device::Get_Used_Sectors( PedPartition *c_partition, const Glib::ustring
//METHOD #2
//this ony works for mounted ( and therefore known to the OS ) filesystems. My method is quite crude, keep in mind it's only temporary ;-)
Glib::ustring buf;
system( ("df -k --sync " + sym_path + " | grep " + sym_path + " > /tmp/.tmp_gparted").c_str() );
std::ifstream file_input( "/tmp/.tmp_gparted" );
file_input >> buf; //skip first value
file_input >> buf;
if ( buf != "0" && ! buf.empty() )
{
if ( ped_partition_is_busy( c_partition ) )
{
Glib::ustring buf;
system( ("df -k --sync " + sym_path + " | grep " + sym_path + " > /tmp/.tmp_gparted").c_str() );
std::ifstream file_input( "/tmp/.tmp_gparted" );
file_input >> buf; //skip first value
file_input >> buf;
file_input.close(); system( "rm -f /tmp/.tmp_gparted" );
return atoi( buf.c_str() ) * 1024/512 ;
if ( buf != "0" && ! buf.empty() )
{
file_input >> buf;
file_input.close(); system( "rm -f /tmp/.tmp_gparted" );
return atoi( buf.c_str() ) * 1024/512 ;
}
file_input.close(); system( "rm -f /tmp/.tmp_gparted" );
}
file_input.close(); system( "rm -f /tmp/.tmp_gparted" );
return -1 ; //all methods were unsuccesfull