Skip to content

Commit fb140ca

Browse files
committed
fix(id): add feat_smack cfg alias
1 parent aac5d86 commit fb140ca

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/uu/id/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ use cfg_aliases::cfg_aliases;
88
pub fn main() {
99
cfg_aliases! {
1010
selinux: { all(feature = "feat_selinux", any(target_os = "android", target_os = "linux")) },
11+
smack: { all(feature = "feat_smack", target_os = "linux") },
1112
}
1213
}

src/uu/id/src/id.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ macro_rules! cstr2cow {
6363
}
6464

6565
fn get_context_help_text() -> String {
66-
#[cfg(not(any(selinux, feature = "smack")))]
66+
#[cfg(not(any(selinux, smack)))]
6767
return translate!("id-context-help-disabled");
68-
#[cfg(any(selinux, feature = "smack"))]
68+
#[cfg(any(selinux, smack))]
6969
return translate!("id-context-help-enabled");
7070
}
7171

@@ -101,7 +101,7 @@ struct State {
101101
cflag: bool, // --context
102102
#[cfg(selinux)]
103103
selinux_supported: bool,
104-
#[cfg(feature = "smack")]
104+
#[cfg(smack)]
105105
smack_supported: bool,
106106
ids: Option<Ids>,
107107
// The behavior for calling GNU's `id` and calling GNU's `id $USER` is similar but different.
@@ -143,7 +143,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
143143

144144
#[cfg(selinux)]
145145
selinux_supported: uucore::selinux::is_selinux_enabled(),
146-
#[cfg(feature = "smack")]
146+
#[cfg(smack)]
147147
smack_supported: uucore::smack::is_smack_enabled(),
148148
user_specified: !users.is_empty(),
149149
ids: None,
@@ -193,7 +193,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
193193
}
194194

195195
// SMACK label
196-
#[cfg(feature = "smack")]
196+
#[cfg(smack)]
197197
if state.smack_supported {
198198
match uucore::smack::get_smack_label_for_self() {
199199
Ok(label) => {
@@ -714,7 +714,7 @@ fn id_print(state: &State, groups: &[u32]) -> io::Result<()> {
714714
}
715715
}
716716

717-
#[cfg(feature = "smack")]
717+
#[cfg(smack)]
718718
if state.smack_supported
719719
&& !state.user_specified
720720
&& std::env::var_os("POSIXLY_CORRECT").is_none()

0 commit comments

Comments
 (0)