From 1606770a3e85dc8342acc7e3e4cc48363be3adea Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Sun, 5 Jun 2016 11:07:28 +0100 Subject: [PATCH] getpwuid is `linux` platform only currently. --- src/ls/ls.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ls/ls.rs b/src/ls/ls.rs index c3803cbfc..cebc60156 100644 --- a/src/ls/ls.rs +++ b/src/ls/ls.rs @@ -164,7 +164,9 @@ fn cstr2string(cstr: *const c_char) -> String { unsafe { String::from_utf8_lossy(CStr::from_ptr(cstr).to_bytes()).to_string() } } -#[cfg(target_family = "unix")] +// Currently getpwuid is `linux` target only. If it's broken out into +// a posix-compliant attribute this can be updated... +#[cfg(target_family = "linux")] fn display_uname(metadata: &Metadata) -> String { use std::os::unix::fs::MetadataExt; @@ -176,7 +178,7 @@ fn display_uname(metadata: &Metadata) -> String { } } -#[cfg(target_family = "unix")] +#[cfg(target_family = "linux")] fn display_group(metadata: &Metadata) -> String { use std::os::unix::fs::MetadataExt; @@ -188,13 +190,13 @@ fn display_group(metadata: &Metadata) -> String { } } -#[cfg(target_family = "windows")] +#[cfg(not(target_family = "linux"))] #[allow(unused_variables)] fn display_uname(metadata: &Metadata) -> String { "somebody".to_string() } -#[cfg(target_family = "windows")] +#[cfg(not(target_family = "linux"))] #[allow(unused_variables)] fn display_group(metadata: &Metadata) -> String { "somegroup".to_string()