Browse Source

use lstat to confirm file existance instead of eaccess. closes #25

pull/37/merge
Antonio SJ Musumeci 10 years ago
parent
commit
8f35406000
  1. 21
      src/fs.cpp

21
src/fs.cpp

@ -142,9 +142,10 @@ namespace fs
{ {
int rv; int rv;
string path; string path;
struct stat st;
path = fs::make_path(*iter,fusepath); path = fs::make_path(*iter,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0) if(rv == 0)
return true; return true;
} }
@ -509,9 +510,10 @@ namespace fs
{ {
int rv; int rv;
string path; string path;
struct stat st;
path = fs::make_path(*iter,fusepath); path = fs::make_path(*iter,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0) if(rv == 0)
{ {
paths.push_back(Path(*iter,path)); paths.push_back(Path(*iter,path));
@ -536,14 +538,11 @@ namespace fs
{ {
int rv; int rv;
string path; string path;
struct stat st;
path = fs::make_path(*iter,fusepath); path = fs::make_path(*iter,fusepath);
rv = ((::eaccess(path.c_str(),R_OK) == 0) ||
(::eaccess(path.c_str(),X_OK) == 0) ||
(::eaccess(path.c_str(),W_OK) == 0));
if(rv)
rv = ::lstat(path.c_str(),&st);
if(rv == 0)
{ {
paths.push_back(Path(*iter,path)); paths.push_back(Path(*iter,path));
return; return;
@ -607,9 +606,10 @@ namespace fs
{ {
int rv; int rv;
string path; string path;
struct stat st;
path = fs::make_path(*iter,fusepath); path = fs::make_path(*iter,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0) if(rv == 0)
paths.push_back(Path(*iter,path)); paths.push_back(Path(*iter,path));
} }
@ -679,6 +679,7 @@ namespace fs
if(rv == 0) if(rv == 0)
{ {
fsblkcnt_t spaceavail; fsblkcnt_t spaceavail;
struct stat st;
spaceavail = (fsstats.f_frsize * fsstats.f_bavail); spaceavail = (fsstats.f_frsize * fsstats.f_bavail);
if(spaceavail > generalmfs) if(spaceavail > generalmfs)
@ -688,7 +689,7 @@ namespace fs
} }
path = fs::make_path(mountpoint,fusepath); path = fs::make_path(mountpoint,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0) if(rv == 0)
{ {
if(spaceavail > existingmfs) if(spaceavail > existingmfs)

Loading…
Cancel
Save