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>
|
2006-01-25 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* src/GParted_Core.cc: improved scanning for root mountpoint (/)
|
* src/GParted_Core.cc: improved scanning for root mountpoint (/)
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <glibmm/ustring.h>
|
#include <glibmm/ustring.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/mount.h>
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
25
src/Utils.cc
25
src/Utils.cc
|
@ -21,6 +21,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
@ -145,16 +146,15 @@ bool Utils::mount( const Glib::ustring & node,
|
||||||
if ( proc_mounts )
|
if ( proc_mounts )
|
||||||
{
|
{
|
||||||
bool hit = false ;
|
bool hit = false ;
|
||||||
char c_node[255], c_mountpoint[255] ;
|
char c_node[255] ;
|
||||||
std::string line ;
|
std::string line ;
|
||||||
|
|
||||||
//search for relevant line in /proc/mounts
|
//search for relevant line in /proc/mounts
|
||||||
while ( getline( proc_mounts, line ) )
|
while ( getline( proc_mounts, line ) )
|
||||||
{
|
{
|
||||||
if ( line .length() > 0 && line[ 0 ] == '/' &&
|
if ( line .length() > 0 && line[ 0 ] == '/' &&
|
||||||
sscanf( line .c_str(),"%s %s", c_node, c_mountpoint ) == 2 &&
|
sscanf( line .c_str(),"%255s", c_node ) == 1 &&
|
||||||
c_node == node && c_mountpoint == mountpoint
|
c_node == node )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
hit = true ;
|
hit = true ;
|
||||||
break ;
|
break ;
|
||||||
|
@ -166,19 +166,14 @@ bool Utils::mount( const Glib::ustring & node,
|
||||||
//append 'line' to /etc/mtab
|
//append 'line' to /etc/mtab
|
||||||
if ( hit )
|
if ( hit )
|
||||||
{
|
{
|
||||||
//in some situations (some livecd's e.g.) /etc/mtab is a (sym)link.
|
std::ofstream mtab( "/etc/mtab", std::ios::app ) ;
|
||||||
char real_path[255] ;
|
|
||||||
if ( realpath( "/etc/mtab", real_path ) )
|
|
||||||
{
|
|
||||||
std::ofstream mtab( real_path, std::ios::app ) ;
|
|
||||||
|
|
||||||
if ( mtab )
|
if ( mtab )
|
||||||
{
|
{
|
||||||
mtab << line << '\n' ;
|
mtab << line << '\n' ;
|
||||||
mtab .close() ;
|
mtab .close() ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "../include/jfs.h"
|
#include "../include/jfs.h"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "../include/xfs.h"
|
#include "../include/xfs.h"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue