Catalog setSize() and utime() implementation.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 9 Oct 2013 12:05:57 +0000 (14:05 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 9 Oct 2013 12:05:57 +0000 (14:05 +0200)
src/VfsNs.cpp

index a11d958..b1787ac 100644 (file)
@@ -1,6 +1,8 @@
 /// @file   VfsNs.cpp
 /// @brief  VFS namespace.
 /// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
+#include <sys/types.h>
+#include <utime.h>
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
@@ -216,7 +218,7 @@ void VfsCatalog::setOwner(const std::string& path, uid_t newUid, gid_t newGid, b
 
 void VfsCatalog::setSize(const std::string& path, size_t newSize) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  wrapCall(truncate(path.c_str(), newSize));
 }
 
 
@@ -239,7 +241,7 @@ void VfsCatalog::setAcl(const std::string& path, const Acl& acl) throw (DmExcept
 
 void VfsCatalog::utime(const std::string& path, const struct utimbuf* buf) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  utime(path.c_str(), buf);
 }