summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/daemon/daemonVolume.cpp46
-rw-r--r--netfs/daemon/daemonVolume.h2
2 files changed, 24 insertions, 24 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp
index 2a6cc09..1a3680f 100644
--- a/netfs/daemon/daemonVolume.cpp
+++ b/netfs/daemon/daemonVolume.cpp
@@ -38,7 +38,7 @@ VolumeServer::access(const NetFS::ReqEnv re, const std::string path, Ice::Int mo
{
ModeCheck mc(re, root, userLookup, groupLookup);
struct stat s;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
if (::stat(p.c_str(), &s) != 0) {
return errno;
}
@@ -64,7 +64,7 @@ VolumeServer::getattr(const NetFS::ReqEnv re, const std::string path, const Ice:
{
ModeCheck mc(re, root, userLookup, groupLookup);
struct stat s;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertReadParent(p);
if (::lstat(p.c_str(), &s) != 0) {
throw NetFS::SystemError(errno);
@@ -77,7 +77,7 @@ VolumeServer::mknod(const NetFS::ReqEnv re, const std::string path, Ice::Int mod
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWriteParent(p);
if (::mknod(p.c_str(), mode, dev) != 0) {
throw NetFS::SystemError(errno);
@@ -89,7 +89,7 @@ VolumeServer::symlink(const NetFS::ReqEnv re, const std::string path1, const std
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path2));
+ std::filesystem::path p(resolvePath(std::move(path2)));
mc.AssertWriteParent(p);
if (::symlink(path1.c_str(), p.c_str()) != 0) {
throw NetFS::SystemError(errno);
@@ -105,8 +105,8 @@ VolumeServer::link(const NetFS::ReqEnv re, const std::string path1, const std::s
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p1(resolvePath(path1));
- std::filesystem::path p2(resolvePath(path2));
+ std::filesystem::path p1(resolvePath(std::move(path1)));
+ std::filesystem::path p2(resolvePath(std::move(path2)));
if (::link(p1.c_str(), p2.c_str()) != 0) {
throw NetFS::SystemError(errno);
}
@@ -121,8 +121,8 @@ VolumeServer::rename(const NetFS::ReqEnv re, const std::string from, const std::
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path f(resolvePath(from));
- std::filesystem::path t(resolvePath(to));
+ std::filesystem::path f(resolvePath(std::move(from)));
+ std::filesystem::path t(resolvePath(std::move(to)));
mc.AssertWriteParent(f);
mc.AssertWriteParent(t);
if (::rename(f.c_str(), t.c_str()) != 0) {
@@ -136,7 +136,7 @@ VolumeServer::readlink(const NetFS::ReqEnv re, const std::string path, const Ice
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
char buf[PATH_MAX];
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertRead(p);
ssize_t rc = ::readlink(p.c_str(), buf, PATH_MAX);
if (rc == -1) {
@@ -150,7 +150,7 @@ VolumeServer::chmod(const NetFS::ReqEnv re, const std::string path, Ice::Int mod
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWritePerms(p);
if (::chmod(p.c_str(), mode) != 0) {
throw NetFS::SystemError(errno);
@@ -162,7 +162,7 @@ VolumeServer::chown(const NetFS::ReqEnv re, const std::string path, Ice::Int uid
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWrite(p);
if (::lchown(p.c_str(), uid, gid) != 0) {
throw NetFS::SystemError(errno);
@@ -180,7 +180,7 @@ VolumeServer::utimens(const NetFS::ReqEnv re, const std::string path,
times[0].tv_nsec = ns0;
times[1].tv_sec = s1;
times[1].tv_nsec = ns1;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWrite(p);
if (::utimensat(0, p.c_str(), times, AT_SYMLINK_NOFOLLOW) != 0) {
throw NetFS::SystemError(errno);
@@ -193,7 +193,7 @@ VolumeServer::statfs(const NetFS::ReqEnv re, const std::string path, const Ice::
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
struct statvfs s;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertRead(p);
if (::statvfs(p.c_str(), &s) != 0) {
throw NetFS::SystemError(errno);
@@ -206,7 +206,7 @@ VolumeServer::truncate(const NetFS::ReqEnv re, const std::string path, Ice::Long
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWrite(p);
if (::truncate(p.c_str(), size) != 0) {
throw NetFS::SystemError(errno);
@@ -218,7 +218,7 @@ VolumeServer::unlink(const NetFS::ReqEnv re, const std::string path, const Ice::
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWriteParent(p);
if (::unlink(p.c_str()) != 0) {
throw NetFS::SystemError(errno);
@@ -230,7 +230,7 @@ VolumeServer::open(const NetFS::ReqEnv re, const std::string path, Ice::Int flag
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertRead(p);
if (flags & O_CREAT) {
throw NetFS::SystemError(EINVAL);
@@ -248,7 +248,7 @@ VolumeServer::create(const NetFS::ReqEnv re, const std::string path, Ice::Int fl
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWriteParent(p);
int fd = ::open(p.c_str(), O_CREAT | O_EXCL | flags, mode);
if (fd == -1) {
@@ -268,7 +268,7 @@ VolumeServer::opendir(const NetFS::ReqEnv re, const std::string path, const Ice:
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertRead(p);
DIR * od = ::opendir(p.c_str());
if (!od) {
@@ -283,7 +283,7 @@ VolumeServer::mkdir(const NetFS::ReqEnv re, const std::string path, Ice::Int mod
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWriteParent(p);
if (::mkdir(p.c_str(), mode) != 0) {
throw NetFS::SystemError(errno);
@@ -299,7 +299,7 @@ VolumeServer::rmdir(const NetFS::ReqEnv re, const std::string path, const Ice::C
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- std::filesystem::path p(resolvePath(path));
+ std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWriteParent(p);
if (::rmdir(p.c_str()) != 0) {
throw NetFS::SystemError(errno);
@@ -307,7 +307,7 @@ VolumeServer::rmdir(const NetFS::ReqEnv re, const std::string path, const Ice::C
}
std::filesystem::path
-normalizedAppend(std::filesystem::path out, const std::filesystem::path & in)
+normalizedAppend(std::filesystem::path out, const std::filesystem::path && in)
{
unsigned int depth = 0;
for(auto e : in) {
@@ -330,8 +330,8 @@ normalizedAppend(std::filesystem::path out, const std::filesystem::path & in)
}
std::filesystem::path
-VolumeServer::resolvePath(const std::string & path) const
+VolumeServer::resolvePath(const std::string && path) const
{
- return normalizedAppend(root, path);
+ return normalizedAppend(root, std::move(path));
}
diff --git a/netfs/daemon/daemonVolume.h b/netfs/daemon/daemonVolume.h
index 1549f6d..6e29893 100644
--- a/netfs/daemon/daemonVolume.h
+++ b/netfs/daemon/daemonVolume.h
@@ -40,7 +40,7 @@ class VolumeServer : public NetFS::Volume {
virtual void disconnect(const Ice::Current&) override;
protected:
- std::filesystem::path resolvePath(const std::string & path) const;
+ std::filesystem::path resolvePath(const std::string && path) const;
private:
const std::filesystem::path root;