diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-03-01 20:04:24 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-05-06 00:40:50 +0100 |
commit | 88f0c774c88237eaf82124cc1fc4f012697eb9e4 (patch) | |
tree | ed1af58c5b479f5872eb5d932d4dc9d35f247f24 /netfs/fuse | |
parent | Add a test over reconnecting to daemon following a restart with open files (diff) | |
download | netfs-88f0c774c88237eaf82124cc1fc4f012697eb9e4.tar.bz2 netfs-88f0c774c88237eaf82124cc1fc4f012697eb9e4.tar.xz netfs-88f0c774c88237eaf82124cc1fc4f012697eb9e4.zip |
Refactor to avoid possible destructed string copy
Diffstat (limited to 'netfs/fuse')
-rw-r--r-- | netfs/fuse/fuseApp.cpp | 5 | ||||
-rw-r--r-- | netfs/fuse/fuseDirs.cpp | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseFiles.cpp | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseMisc.cpp | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index c90cc15..fdcce57 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -171,6 +171,9 @@ NetFS::FuseApp::reqEnv() connectToService(); connectToVolume(); struct fuse_context * c = fuse_get_context(); - return { UserEntCache::instance.getName(c->uid), GroupEntCache::instance.getName(c->gid) }; + NetFS::ReqEnv re; + UserEntCache::instance.getName(c->uid, &re.user); + GroupEntCache::instance.getName(c->gid, &re.grp); + return re; } diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index 156dae6..1da9484 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -79,7 +79,7 @@ NetFS::FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_ statCache.Add(new OptimisticCallCacheable<struct stat, std::string, IceUtil::Shared>( [asga,this]() { struct stat s; - s << AttrSource { volume->end_getattr(asga), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1) }; + s << AttrSource { volume->end_getattr(asga), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) }; return s; }, epath, time_t(NULL) + 2)); } diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index b8399f0..c6d4283 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -135,7 +135,7 @@ NetFS::FuseApp::fgetattr(const char *, struct stat * s, fuse_file_info * fi) { try { auto remote = getFileProxy(fi->fh)->remote; - *s << AttrSource { remote->fgetattr(reqEnv()), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1) }; + *s << AttrSource { remote->fgetattr(reqEnv()), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) }; return 0; } catch (NetFS::SystemError & e) { diff --git a/netfs/fuse/fuseMisc.cpp b/netfs/fuse/fuseMisc.cpp index 670c9ae..1f999bd 100644 --- a/netfs/fuse/fuseMisc.cpp +++ b/netfs/fuse/fuseMisc.cpp @@ -19,7 +19,7 @@ NetFS::FuseApp::getattr(const char * p, struct stat * s) *s = *cacehedStat; } else { - *s << AttrSource { volume->getattr(reqEnv(), p), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1) }; + *s << AttrSource { volume->getattr(reqEnv(), p), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) }; } return 0; } |