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:
parent
808b777019
commit
523bc6a6b4
|
@ -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.
|
||||||
|
|
|
@ -278,10 +278,13 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
void GParted_Core::set_mountpoints( std::vector<Partition> & partitions, bool first_time )
|
void GParted_Core::set_mountpoints( std::vector<Partition> & partitions, bool first_time )
|
||||||
{
|
{
|
||||||
if ( first_time )
|
if ( first_time )
|
||||||
|
{
|
||||||
|
std::ifstream input( "/proc/mounts" ) ;
|
||||||
|
|
||||||
|
if ( input )
|
||||||
{
|
{
|
||||||
char node[255], mountpoint[255] ;
|
char node[255], mountpoint[255] ;
|
||||||
std::string line ;
|
std::string line ;
|
||||||
std::ifstream input( "/proc/mounts" ) ;
|
|
||||||
|
|
||||||
while ( getline( input, 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 )
|
||||||
|
@ -289,6 +292,7 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions, bool fi
|
||||||
|
|
||||||
input .close() ;
|
input .close() ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "../include/Utils.h"
|
#include "../include/Utils.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
//#include <vector>
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue