summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-12-31 19:19:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2020-12-31 19:19:56 +0000
commit74c1f65d9503ee9edf9a29d059948b2e6b08201c (patch)
tree17d33a0cf00f1a42dc2315c33841216a80827f08
parentAdd missing call to fuse_opt_free_args in test (diff)
downloadnetfs-74c1f65d9503ee9edf9a29d059948b2e6b08201c.tar.bz2
netfs-74c1f65d9503ee9edf9a29d059948b2e6b08201c.tar.xz
netfs-74c1f65d9503ee9edf9a29d059948b2e6b08201c.zip
Minor code tidy
-rw-r--r--netfs/lib/entCache.impl.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/netfs/lib/entCache.impl.h b/netfs/lib/entCache.impl.h
index 0021f00..13263af 100644
--- a/netfs/lib/entCache.impl.h
+++ b/netfs/lib/entCache.impl.h
@@ -102,8 +102,6 @@ EntCache<entry_t>::clearFallback()
User::User(uid_t u, std::string n, gid_t g) : id(u), name(std::move(n)), group(g) { }
-const int BUFLEN = 8196;
-
template<>
void
EntCache<User>::fillCache() const
@@ -111,9 +109,8 @@ EntCache<User>::fillCache() const
Lock(lock);
setpwent();
idcache->clear();
- std::array<char, BUFLEN> buf {};
- struct passwd pwbuf {
- }, *pwp;
+ std::array<char, BUFSIZ> buf {};
+ passwd pwbuf {}, *pwp;
while (getpwent_r(&pwbuf, buf.data(), buf.size(), &pwp) == 0) {
idcache->insert(std::make_shared<User>(pwp->pw_uid, pwp->pw_name, pwp->pw_gid));
}
@@ -129,10 +126,9 @@ EntCache<Group>::fillCache() const
{
Lock(lock);
setgrent();
- std::array<char, BUFLEN> buf {};
+ std::array<char, BUFSIZ> buf {};
idcache->clear();
- struct group grpbuf {
- }, *grp;
+ group grpbuf {}, *grp;
EntCache<User> instance;
while (getgrent_r(&grpbuf, buf.data(), buf.size(), &grp) == 0) {
auto g = std::make_shared<Group>(grp->gr_gid, grp->gr_name);