Compare commits

...

2 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 4a2a49312b
Fix formatting 2018-12-03 00:11:00 +01:00
Přemysl Eric Janouch 7174b507d3
Fix crash on unknown groups 2018-12-01 15:57:35 +01:00
1 changed files with 5 additions and 3 deletions

View File

@ -627,7 +627,7 @@ fun make_entry (const struct dirent *f) -> entry {
: apply_attrs (to_wstring (info.st_uid), 0);
auto grp = g.gnames.find (info.st_gid);
e.cols[entry::GROUP] = (grp != g.unames.end ())
e.cols[entry::GROUP] = (grp != g.gnames.end ())
? apply_attrs (to_wide (grp->second), 0)
: apply_attrs (to_wstring (info.st_gid), 0);
@ -743,11 +743,13 @@ fun operator< (const entry &e1, const entry &e2) -> bool {
fun reload () {
g.unames.clear();
while (auto *ent = getpwent ()) g.unames.emplace(ent->pw_uid, ent->pw_name);
while (auto *ent = getpwent ())
g.unames.emplace (ent->pw_uid, ent->pw_name);
endpwent();
g.gnames.clear();
while (auto *ent = getgrent ()) g.gnames.emplace(ent->gr_gid, ent->gr_name);
while (auto *ent = getgrent ())
g.gnames.emplace (ent->gr_gid, ent->gr_name);
endgrent();
string anchor;