only add mountpoints and paths if they exist don't show '<none>' if

* src/GParted_Core.cc: only add mountpoints and paths if they exist
* src/reiser4.cc: don't show '<none>' if volumelabel is empty
This commit is contained in:
Bart Hakvoort 2006-10-01 13:45:55 +00:00
parent ac82ee0453
commit 2bd5fff210
3 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2006-10-01 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: only add mountpoints and paths if they exist
* src/reiser4.cc: don't show '<none>' if volumelabel is empty
2006-10-01 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-10-01 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core: Replaced std::abs with llabs (see #357691) * src/GParted_Core: Replaced std::abs with llabs (see #357691)

View File

@ -479,7 +479,10 @@ void GParted_Core::init_maps()
line = "/dev/" ; line = "/dev/" ;
line += c_str ; line += c_str ;
if ( realpath( line .c_str(), c_str ) && line != c_str ) //FIXME: it seems realpath is very unsafe to use (manpage)...
if ( file_test( line, Glib::FILE_TEST_EXISTS ) &&
realpath( line .c_str(), c_str ) &&
line != c_str )
{ {
//because we can make no assumption about which path libparted will detect //because we can make no assumption about which path libparted will detect
//we add all combinations. //we add all combinations.
@ -513,8 +516,10 @@ void GParted_Core::read_mountpoints_from_file( const Glib::ustring & filename,
index = line .find( "\\040" ) ; index = line .find( "\\040" ) ;
if ( index < line .length() ) if ( index < line .length() )
line .replace( index, 4, " " ) ; line .replace( index, 4, " " ) ;
map[ node ] .push_back( line ) ; //only add this path if it exists
if ( file_test( line, Glib::FILE_TEST_EXISTS ) )
map[ node ] .push_back( line ) ;
} }
file .close() ; file .close() ;

View File

@ -87,7 +87,10 @@ void reiser4::get_label( Partition & partition )
char buf[512] ; char buf[512] ;
index = output .find( "label" ) ; index = output .find( "label" ) ;
if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "label: %512s", buf ) == 1 ) //FIXME: find a better way to see if label is empty.. imagine someone uses '<none>' as label.... ;)
if ( index < output .length() &&
sscanf( output .substr( index ) .c_str(), "label: %512s", buf ) == 1 &&
Glib::ustring( buf ) != "<none>" )
partition .label = buf ; partition .label = buf ;
} }
else else