fixed small issue with mounting. (discovered on the livecd)
* include/Utils.h, src/Utils.cc, src/jfs.cc, src/xfs.cc: fixed small issue with mounting. (discovered on the livecd)
This commit is contained in:
parent
409096f739
commit
06cab31e44
|
@ -1,3 +1,11 @@
|
|||
2006-01-25 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/Utils.h,
|
||||
src/Utils.cc,
|
||||
src/jfs.cc,
|
||||
src/xfs.cc: fixed small issue with mounting. (discovered on the
|
||||
livecd)
|
||||
|
||||
2006-01-25 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/GParted_Core.cc: improved scanning for root mountpoint (/)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <glibmm/ustring.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/mount.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
|
15
src/Utils.cc
15
src/Utils.cc
|
@ -21,6 +21,7 @@
|
|||
#include <fstream>
|
||||
#include <cerrno>
|
||||
#include <iomanip>
|
||||
#include <sys/mount.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
@ -145,16 +146,15 @@ bool Utils::mount( const Glib::ustring & node,
|
|||
if ( proc_mounts )
|
||||
{
|
||||
bool hit = false ;
|
||||
char c_node[255], c_mountpoint[255] ;
|
||||
char c_node[255] ;
|
||||
std::string line ;
|
||||
|
||||
//search for relevant line in /proc/mounts
|
||||
while ( getline( proc_mounts, line ) )
|
||||
{
|
||||
if ( line .length() > 0 && line[ 0 ] == '/' &&
|
||||
sscanf( line .c_str(),"%s %s", c_node, c_mountpoint ) == 2 &&
|
||||
c_node == node && c_mountpoint == mountpoint
|
||||
)
|
||||
sscanf( line .c_str(),"%255s", c_node ) == 1 &&
|
||||
c_node == node )
|
||||
{
|
||||
hit = true ;
|
||||
break ;
|
||||
|
@ -166,11 +166,7 @@ bool Utils::mount( const Glib::ustring & node,
|
|||
//append 'line' to /etc/mtab
|
||||
if ( hit )
|
||||
{
|
||||
//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 ) ;
|
||||
std::ofstream mtab( "/etc/mtab", std::ios::app ) ;
|
||||
|
||||
if ( mtab )
|
||||
{
|
||||
|
@ -180,7 +176,6 @@ bool Utils::mount( const Glib::ustring & node,
|
|||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//something went wrong while adding the line to mtab
|
||||
umount( mountpoint .c_str() ) ;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../include/jfs.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <sys/mount.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../include/xfs.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <sys/mount.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue