1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Fill in group name for ls

This commit is contained in:
Steve Smith 2016-06-04 15:14:59 +01:00
parent 04522760f1
commit ce7f23bcc4

View file

@ -177,7 +177,13 @@ fn display_uname(metadata: &Metadata) -> String {
fn display_group(metadata: &Metadata) -> String {
use std::os::unix::fs::MetadataExt;
metadata.uid().to_string()
let ent = unsafe { getgrgid(metadata.gid()) };
if !ent.is_null() {
cstr2string(unsafe { ptr::read(ent).gr_name })
} else {
metadata.gid().to_string()
}
}
fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String {