From f3cb21e1aab1e206baf69ef72ceb4a62d5983993 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 10 Jul 2013 13:43:17 +0200 Subject: [PATCH] Catalog create(), setMode() implementation, setOwner() not supported. --- src/VfsNs.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/VfsNs.cpp b/src/VfsNs.cpp index 8ac10c5..a11d958 100644 --- a/src/VfsNs.cpp +++ b/src/VfsNs.cpp @@ -1,6 +1,7 @@ /// @file VfsNs.cpp /// @brief VFS namespace. /// @author Alejandro Álvarez Ayllón +#include #include #include #include @@ -182,7 +183,12 @@ void VfsCatalog::unlink(const std::string& path) throw (DmException) void VfsCatalog::create(const std::string& path, mode_t mode) throw (DmException) { - throw DmException(EACCES, "Write mode not supported"); + FILE *f; + + wrapCall(f = fopen(path.c_str(), "w")); + wrapCall(fclose(f)); + + setMode(path, mode); } @@ -196,14 +202,14 @@ mode_t VfsCatalog::umask(mode_t mask) throw () void VfsCatalog::setMode(const std::string& path, mode_t mode) throw (DmException) { - throw DmException(EACCES, "Write mode not supported"); + wrapCall(chmod(path.c_str(), mode)); } void VfsCatalog::setOwner(const std::string& path, uid_t newUid, gid_t newGid, bool followSymLink) throw (DmException) { - throw DmException(EACCES, "Write mode not supported"); + vfsThrow(ENOSYS, "changing owner not supported"); } -- 1.8.2.3