Properly truncate the file on re-create (using xattr with size instead of truncate()).
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 2 Dec 2013 12:58:36 +0000 (13:58 +0100)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 23 Feb 2014 13:16:20 +0000 (14:16 +0100)
src/VfsNs.cpp

index 6e5f8a2..fe05072 100644 (file)
@@ -702,8 +702,8 @@ void VfsCatalog::create(const std::string& path, mode_t mode) throw (DmException
     for (it = file.begin(); it != file.end() && it->first.compare(0, VFS_XATTR_LENGTH + 8, VFS_XATTR "replica.") != 0; it++);
     if (it != file.end())
       vfsThrow(EACCES, "can't truncate '%s' with replicas", path.c_str());
-    // FIXME: setSize()
-    wrapCall(truncate(lpath.c_str(), 0));
+    // setSize(path, 0)
+    vfsSetXattr(path, lpath, VFS_XATTR "size", "0", 0);
   }
 }