summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/daemon/daemonVolume.cpp2
-rw-r--r--netfs/unittests/testCore.cpp12
2 files changed, 6 insertions, 8 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp
index 2d67272..e4c65bd 100644
--- a/netfs/daemon/daemonVolume.cpp
+++ b/netfs/daemon/daemonVolume.cpp
@@ -262,7 +262,7 @@ VolumeServer::create(const NetFS::ReqEnv & re, const std::string & path, Ice::In
errno = 0;
boost::filesystem::path p(resolvePath(path));
mc.AssertWriteParent(p);
- int fd = ::open(p.c_str(), O_CREAT | flags, mode);
+ int fd = ::open(p.c_str(), O_CREAT | O_EXCL | flags, mode);
if (fd == -1) {
throw NetFS::SystemError(errno);
}
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp
index 9610111..e933027 100644
--- a/netfs/unittests/testCore.cpp
+++ b/netfs/unittests/testCore.cpp
@@ -122,14 +122,12 @@ BOOST_AUTO_TEST_CASE( testSandboxing )
BOOST_REQUIRE(!boost::filesystem::exists(binDir / "outside"));
BOOST_REQUIRE_EQUAL(fuse->create("/../sub/../outside", 0666, &fi), -EPERM);
BOOST_REQUIRE(!boost::filesystem::exists(binDir / "outside"));
- int fd = fuse->create("/inside", 0666, &fi);
- BOOST_REQUIRE(fd >= 0);
- fuse->release("/inside", &fi);
- BOOST_REQUIRE(boost::filesystem::exists(binDir / testExport / "inside"));
- int fd2 = fuse->create("inside", 0666, &fi);
- BOOST_REQUIRE(fd2 >= 0);
- fuse->release("inside", &fi);
+ BOOST_REQUIRE_EQUAL(fuse->create("/inside", 0666, &fi), 0);
+ BOOST_REQUIRE_EQUAL(fuse->release("/inside", &fi), 0);
BOOST_REQUIRE(boost::filesystem::exists(binDir / testExport / "inside"));
+ BOOST_REQUIRE_EQUAL(fuse->create("inside2", 0666, &fi), 0);
+ BOOST_REQUIRE_EQUAL(fuse->release("inside2", &fi), 0);
+ BOOST_REQUIRE(boost::filesystem::exists(binDir / testExport / "inside2"));
}
int