From 06cab31e44538be6a48c1b40da11367ef8ee5e4b Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Wed, 25 Jan 2006 14:50:26 +0000 Subject: [PATCH] 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) --- ChangeLog | 8 ++++++++ include/Utils.h | 1 - src/Utils.cc | 25 ++++++++++--------------- src/jfs.cc | 1 + src/xfs.cc | 1 + 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f8ce915..3da87f68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-01-25 Bart Hakvoort + + * 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 * src/GParted_Core.cc: improved scanning for root mountpoint (/) diff --git a/include/Utils.h b/include/Utils.h index cfcd5639..142c152c 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -30,7 +30,6 @@ #include #include -#include namespace GParted { diff --git a/src/Utils.cc b/src/Utils.cc index ae3f8e19..f0ac634b 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -21,6 +21,7 @@ #include #include #include +#include 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,19 +166,14 @@ 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 ) - { - mtab << line << '\n' ; - mtab .close() ; + if ( mtab ) + { + mtab << line << '\n' ; + mtab .close() ; - return true ; - } + return true ; } } diff --git a/src/jfs.cc b/src/jfs.cc index 73edc64e..181d0703 100644 --- a/src/jfs.cc +++ b/src/jfs.cc @@ -19,6 +19,7 @@ #include "../include/jfs.h" #include +#include namespace GParted { diff --git a/src/xfs.cc b/src/xfs.cc index dcb167e1..e2ef8195 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -19,6 +19,7 @@ #include "../include/xfs.h" #include +#include namespace GParted {