check if file is open before using it. removed commented include

* src/GParted_Core.cc: check if file is open before using it.
* src/Utils.cc: removed commented include
This commit is contained in:
Bart Hakvoort 2005-12-13 22:07:01 +00:00
parent 808b777019
commit 523bc6a6b4
3 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2005-12-13 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: check if file is open before using it.
* src/Utils.cc: removed commented include
2005-12-13 Bart Hakvoort <hakvoort@cvs.gnome.org> 2005-12-13 Bart Hakvoort <hakvoort@cvs.gnome.org>
* replaced the inline Utils functions with static functions. * replaced the inline Utils functions with static functions.

View File

@ -279,15 +279,19 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions, bool fi
{ {
if ( first_time ) if ( first_time )
{ {
char node[255], mountpoint[255] ;
std::string line ;
std::ifstream input( "/proc/mounts" ) ; std::ifstream input( "/proc/mounts" ) ;
while ( getline( input, line ) ) if ( input )
{
char node[255], mountpoint[255] ;
std::string line ;
while ( getline( input, line ) )
if ( line .length() > 0 && line[ 0 ] == '/' && sscanf( line .c_str(),"%s %s", node, mountpoint ) == 2 ) if ( line .length() > 0 && line[ 0 ] == '/' && sscanf( line .c_str(),"%s %s", node, mountpoint ) == 2 )
mount_info[ node ] = mountpoint ; mount_info[ node ] = mountpoint ;
input .close() ; input .close() ;
}
} }

View File

@ -18,7 +18,6 @@
#include "../include/Utils.h" #include "../include/Utils.h"
#include <sstream> #include <sstream>
//#include <vector>
namespace GParted namespace GParted
{ {