From 345d0bbdc4a22b80aa296fc4f2ee04f482bb4b09 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Tue, 27 May 2014 18:17:54 -0400 Subject: [PATCH] use eaccess to determine permissions for ffwp. closes #2 --- src/fs.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fs.cpp b/src/fs.cpp index f11847d2..c875e757 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -220,12 +220,17 @@ namespace fs for(vector::const_iterator iter = beginiter; iter != enditer; ++iter) { - int rv; - struct stat st; - string path; + int rv; + string path; path = make_path(*iter,suffix); - rv = ::lstat(path.c_str(),&st); + rv = ::eaccess(path.c_str(),R_OK); + if(rv == 0) + return Path(*iter,path); + rv = ::eaccess(path.c_str(),W_OK); + if(rv == 0) + return Path(*iter,path); + rv = ::eaccess(path.c_str(),X_OK); if(rv == 0) return Path(*iter,path); }