summaryrefslogtreecommitdiff
path: root/netfs/daemon/daemonVolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netfs/daemon/daemonVolume.cpp')
-rw-r--r--netfs/daemon/daemonVolume.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp
index 1a3680f..fd2f895 100644
--- a/netfs/daemon/daemonVolume.cpp
+++ b/netfs/daemon/daemonVolume.cpp
@@ -1,9 +1,9 @@
#include <Ice/ObjectAdapter.h>
-#include <errno.h>
+#include <cerrno>
#include <map>
#include <unistd.h>
#include <sys/stat.h>
-#include <limits.h>
+#include <climits>
#include <fcntl.h>
#include "daemonVolume.h"
#include "daemonFile.h"
@@ -23,10 +23,6 @@ VolumeServer::VolumeServer(const std::filesystem::path & r, const EntCache<User>
{
}
-VolumeServer::~VolumeServer()
-{
-}
-
void
VolumeServer::disconnect(const Ice::Current & ice)
{
@@ -135,14 +131,15 @@ 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::string buf(PATH_MAX, 0);
std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertRead(p);
- ssize_t rc = ::readlink(p.c_str(), buf, PATH_MAX);
+ ssize_t rc = ::readlink(p.c_str(), buf.data(), PATH_MAX);
if (rc == -1) {
throw NetFS::SystemError(errno);
}
- return std::string(buf, rc);
+ buf.resize(rc);
+ return buf;
}
void
@@ -175,14 +172,10 @@ VolumeServer::utimens(const NetFS::ReqEnv re, const std::string path,
{
ModeCheck mc(re, root, userLookup, groupLookup);
errno = 0;
- struct timespec times[2];
- times[0].tv_sec = s0;
- times[0].tv_nsec = ns0;
- times[1].tv_sec = s1;
- times[1].tv_nsec = ns1;
+ std::array<struct timespec, 2> times { { { s0, ns0 }, { s1, ns1 } } };
std::filesystem::path p(resolvePath(std::move(path)));
mc.AssertWrite(p);
- if (::utimensat(0, p.c_str(), times, AT_SYMLINK_NOFOLLOW) != 0) {
+ if (::utimensat(0, p.c_str(), times.data(), AT_SYMLINK_NOFOLLOW) != 0) {
throw NetFS::SystemError(errno);
}
}