ls: Write group name instead of gid in list mode
This commit is contained in:
parent
668c4c8976
commit
753de3d9f0
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <grp.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -84,7 +85,10 @@ BAN::String build_owner_name_string(uid_t uid)
|
||||||
|
|
||||||
BAN::String build_owner_group_string(gid_t gid)
|
BAN::String build_owner_group_string(gid_t gid)
|
||||||
{
|
{
|
||||||
|
struct group* grp = getgrgid(gid);
|
||||||
|
if (grp == nullptr)
|
||||||
return BAN::String::formatted("{}", gid);
|
return BAN::String::formatted("{}", gid);
|
||||||
|
return BAN::String(BAN::StringView(grp->gr_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
BAN::String build_size_string(off_t size)
|
BAN::String build_size_string(off_t size)
|
||||||
|
|
Loading…
Reference in New Issue