fixed error with mountpoints containing whitespaces. (#329247)
* src/GParted_Core.cc: fixed error with mountpoints containing whitespaces. (#329247)
This commit is contained in:
parent
0be40a4f0b
commit
9b02213d27
|
@ -1,3 +1,8 @@
|
|||
2006-01-30 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/GParted_Core.cc: fixed error with mountpoints containing
|
||||
whitespaces. (#329247)
|
||||
|
||||
2006-01-30 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* configure.in: bump to gparted-0.2
|
||||
|
|
|
@ -166,14 +166,23 @@ void GParted_Core::init_maps()
|
|||
|
||||
//initialize mountpoints..
|
||||
char node[255], mountpoint[255] ;
|
||||
unsigned int index ;
|
||||
std::ifstream proc_mounts( "/proc/mounts" ) ;
|
||||
if ( proc_mounts )
|
||||
{
|
||||
while ( getline( proc_mounts, line ) )
|
||||
if ( line .length() > 0 &&
|
||||
line[ 0 ] == '/' &&
|
||||
sscanf( line .c_str(), "%s %s", node, mountpoint ) == 2 )
|
||||
mount_info[ node ] = mountpoint ;
|
||||
sscanf( line .c_str(), "%255s %255s", node, mountpoint ) == 2 )
|
||||
{
|
||||
//see if mountpoint contains spaces and deal with it
|
||||
line = mountpoint ;
|
||||
index = line .find( "\\040" ) ;
|
||||
if ( index < line .length() )
|
||||
line .replace( index, 4, " " ) ;
|
||||
|
||||
mount_info[ node ] = line ;
|
||||
}
|
||||
|
||||
proc_mounts .close() ;
|
||||
}
|
||||
|
@ -185,10 +194,10 @@ void GParted_Core::init_maps()
|
|||
while ( getline( etc_mtab, line ) )
|
||||
if ( line .length() > 0 &&
|
||||
line[ 0 ] == '/' &&
|
||||
sscanf( line .c_str(), "%s %s", node, mountpoint ) == 2 &&
|
||||
sscanf( line .c_str(), "%255s %255s", node, mountpoint ) == 2 &&
|
||||
static_cast<Glib::ustring>( mountpoint ) == "/" )
|
||||
{
|
||||
mount_info[ node ] = mountpoint ;
|
||||
mount_info[ node ] = "/" ;
|
||||
break ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue