Skip to content

Commit da03e45

Browse files
committed
fix(mknod): add feat_selinux cfg alias
1 parent 2ea20be commit da03e45

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/uu/mknod/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use cfg_aliases::cfg_aliases;
77

88
pub fn main() {
99
cfg_aliases! {
10+
selinux: { all(feature = "feat_selinux", any(target_os = "android", target_os = "linux")) },
1011
smack: { all(feature = "feat_smack", target_os = "linux") },
1112
}
1213
}

src/uu/mknod/src/mknod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ struct Config {
5757
dev: u64,
5858

5959
/// Set security context (SELinux/SMACK).
60-
#[cfg(any(feature = "selinux", smack))]
60+
#[cfg(any(selinux, smack))]
6161
set_security_context: bool,
6262

6363
/// Specific security context (SELinux/SMACK).
64-
#[cfg(any(feature = "selinux", smack))]
64+
#[cfg(any(selinux, smack))]
6565
context: Option<String>,
6666
}
6767

@@ -96,7 +96,7 @@ fn mknod(file_name: &str, config: Config) -> i32 {
9696
}
9797

9898
// Apply SELinux context if requested
99-
#[cfg(feature = "selinux")]
99+
#[cfg(selinux)]
100100
if config.set_security_context {
101101
if let Err(e) = uucore::selinux::set_selinux_security_context(
102102
std::path::Path::new(file_name),
@@ -146,9 +146,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
146146
.expect("Missing argument 'NAME'");
147147

148148
// Extract the security context related flags and options
149-
#[cfg(any(feature = "selinux", smack))]
149+
#[cfg(any(selinux, smack))]
150150
let set_security_context = matches.get_flag(options::SECURITY_CONTEXT);
151-
#[cfg(any(feature = "selinux", smack))]
151+
#[cfg(any(selinux, smack))]
152152
let context = matches.get_one::<String>(options::CONTEXT).cloned();
153153

154154
let dev = match (
@@ -177,9 +177,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
177177
file_type: file_type.clone(),
178178
use_umask,
179179
dev,
180-
#[cfg(any(feature = "selinux", smack))]
180+
#[cfg(any(selinux, smack))]
181181
set_security_context: set_security_context || context.is_some(),
182-
#[cfg(any(feature = "selinux", smack))]
182+
#[cfg(any(selinux, smack))]
183183
context,
184184
};
185185

0 commit comments

Comments
 (0)