Skip to content

Commit

Permalink
use lstat to confirm file existance instead of eaccess. closes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
trapexit committed Aug 22, 2014
1 parent 2e65090 commit 191e48f
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ namespace fs
{
int rv;
string path;
struct stat st;

path = fs::make_path(*iter,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0)
return true;
}
Expand Down Expand Up @@ -507,11 +508,12 @@ namespace fs
iter != eiter;
++iter)
{
int rv;
string path;
int rv;
string path;
struct stat st;

path = fs::make_path(*iter,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0)
{
paths.push_back(Path(*iter,path));
Expand All @@ -536,14 +538,11 @@ namespace fs
{
int rv;
string path;
struct stat st;

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));
return;
Expand Down Expand Up @@ -576,8 +575,8 @@ namespace fs
iter != eiter;
++iter)
{
int rv;
struct stat st;
int rv;
struct stat st;
const string path = fs::make_path(*iter,fusepath);

rv = ::lstat(path.c_str(),&st);
Expand Down Expand Up @@ -605,11 +604,12 @@ namespace fs
iter != eiter;
++iter)
{
int rv;
string path;
int rv;
string path;
struct stat st;

path = fs::make_path(*iter,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0)
paths.push_back(Path(*iter,path));
}
Expand Down Expand Up @@ -679,6 +679,7 @@ namespace fs
if(rv == 0)
{
fsblkcnt_t spaceavail;
struct stat st;

spaceavail = (fsstats.f_frsize * fsstats.f_bavail);
if(spaceavail > generalmfs)
Expand All @@ -688,7 +689,7 @@ namespace fs
}

path = fs::make_path(mountpoint,fusepath);
rv = ::eaccess(path.c_str(),F_OK);
rv = ::lstat(path.c_str(),&st);
if(rv == 0)
{
if(spaceavail > existingmfs)
Expand Down

0 comments on commit 191e48f

Please sign in to comment.