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>
* replaced the inline Utils functions with static functions.

View File

@ -278,10 +278,13 @@ void GParted_Core::set_device_partitions( Device & device )
void GParted_Core::set_mountpoints( std::vector<Partition> & partitions, bool first_time )
{
if ( first_time )
{
std::ifstream input( "/proc/mounts" ) ;
if ( input )
{
char node[255], mountpoint[255] ;
std::string line ;
std::ifstream input( "/proc/mounts" ) ;
while ( getline( input, line ) )
if ( line .length() > 0 && line[ 0 ] == '/' && sscanf( line .c_str(),"%s %s", node, mountpoint ) == 2 )
@ -289,6 +292,7 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions, bool fi
input .close() ;
}
}
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )

View File

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