+bool VfsCatalog::access(const std::string& path, int mode) throw (DmException)
+{
+ struct stat fstat;
+
+ if (stat(path.c_str(), &fstat) == -1) {
+ if (errno == ENOENT) {
+ // throw exeption up only if there was not requested test for existence (F_OK)
+ if (mode & F_OK) return false;
+ else vfsThrowErrno("stat() failed on '" + path + "' (stat)");
+ } else
+ vfsThrowErrno("stat() failed on '" + path + "' (stat)");
+ }
+
+ if (::access(path.c_str(), mode) == -1) {
+ if (errno == ENOENT) {
+ // stat() performed OK, but access() failed with ENOENT
+ vfsThrowErrno("access() failed with ENOENT on '" + path + "' (dangling symlink?)");
+ } else
+ return false;
+ }
+
+ return true;
+}
+
+
+
void VfsCatalog::addReplica(const Replica& replica) throw (DmException)
{
throw DmException(EACCES, "Write mode not supported");
std::string getWorkingDir (void) throw (DmException);
ExtendedStat extendedStat(const std::string&, bool) throw (DmException);
+ bool access(const std::string& path, int mode) throw (DmException);
SymLink readLink(ino_t) throw (DmException);