test-rename test hack.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 10 Oct 2013 12:44:13 +0000 (14:44 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 10 Oct 2013 12:44:13 +0000 (14:44 +0200)
src/VfsNs.cpp

index 3309244..a6ff7bf 100644 (file)
@@ -380,7 +380,14 @@ void VfsCatalog::makeDir(const std::string& path, mode_t mode) throw (DmExceptio
 
 void VfsCatalog::rename(const std::string& oldPath, const std::string& newPath) throw (DmException)
 {
-  wrapCall(::rename(oldPath.c_str(), newPath.c_str()));
+  // XXX: test-rename should probably accept both ENOTEMPTY and EEXIST instead
+  //      of changing it here?
+  try {
+    wrapCall(::rename(oldPath.c_str(), newPath.c_str()));
+  } catch (DmException e) {
+    if (e.code() == ENOTEMPTY) e = DmException(EEXIST, e.what());
+    throw e;
+  }
 }