Catalog create(), setMode() implementation, setOwner() not supported.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 10 Jul 2013 11:43:17 +0000 (13:43 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 9 Oct 2013 12:05:57 +0000 (14:05 +0200)
src/VfsNs.cpp

index 8ac10c5..a11d958 100644 (file)
@@ -1,6 +1,7 @@
 /// @file   VfsNs.cpp
 /// @brief  VFS namespace.
 /// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
+#include <cstdio>
 #include <cstdlib>
 #include <cstring>
 #include <dmlite/cpp/dmlite.h>
@@ -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");
 }