use realpath() to get absolute path to 'real' /etc/mtab. unmount if

* src/Utils.cc: use realpath() to get absolute path to 'real'
  /etc/mtab.
  unmount if something went wrong while adding the line to '/etc/mtab'
* src/Dialog_Progress.cc: replaced PACK_SHRINK with PACK_EXPAND_WIDGET
This commit is contained in:
Bart Hakvoort 2006-01-24 16:41:36 +00:00
parent e8a628ada4
commit 669f0654d8
3 changed files with 22 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2006-01-24 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/Utils.cc: use realpath() to get absolute path to 'real'
/etc/mtab.
unmount if something went wrong while adding the line to '/etc/mtab'
* src/Dialog_Progress.cc: replaced PACK_SHRINK with PACK_EXPAND_WIDGET
2006-01-24 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: swapped 'line' and 'c_str' to make

View File

@ -88,7 +88,7 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation> & operations )
expander_details .set_use_markup( true ) ;
expander_details .add( scrolledwindow ) ;
this ->get_vbox() ->pack_start( expander_details, Gtk::PACK_SHRINK ) ;
this ->get_vbox() ->pack_start( expander_details, Gtk::PACK_EXPAND_WIDGET ) ;
this ->get_vbox() ->set_spacing( 5 ) ;
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_NONE ) ;

View File

@ -166,7 +166,11 @@ bool Utils::mount( const Glib::ustring & node,
//append 'line' to /etc/mtab
if ( hit )
{
std::ofstream mtab( "/etc/mtab", std::ios::app ) ;
//in some situations (some livecd's e.g.) /etc/mtab is a (sym)link.
char real_path[255] ;
if ( realpath( "/etc/mtab", real_path ) )
{
std::ofstream mtab( real_path, std::ios::app ) ;
if ( mtab )
{
@ -177,6 +181,10 @@ bool Utils::mount( const Glib::ustring & node,
}
}
}
//something went wrong while adding the line to mtab
umount( mountpoint .c_str() ) ;
}
}
else
error = Glib::strerror( errno ) ;