Skip to content

Commit 11ffe4b

Browse files
committed
mkfifo: add selinux/smack cfg alias
1 parent 204954a commit 11ffe4b

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/mkfifo/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ path = "src/mkfifo.rs"
1919
test = false
2020
doctest = false
2121

22+
[build-dependencies]
23+
cfg_aliases.workspace = true
24+
2225
[dependencies]
2326
clap = { workspace = true }
2427
uucore = { workspace = true, features = ["fs", "mode"] }

src/uu/mkfifo/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This file is part of the uutils coreutils package.
2+
//
3+
// For the full copyright and license information, please view the LICENSE
4+
// file that was distributed with this source code.
5+
6+
use cfg_aliases::cfg_aliases;
7+
8+
pub fn main() {
9+
cfg_aliases! {
10+
selinux: { all(feature = "selinux", any(target_os = "android", target_os = "linux")) },
11+
smack: { all(feature = "smack", target_os = "linux") },
12+
}
13+
}

src/uu/mkfifo/src/mkfifo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
6565
}
6666

6767
// Apply SELinux context if requested
68-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
68+
#[cfg(selinux)]
6969
{
7070
// Extract the SELinux related flags and options
7171
let set_security_context = matches.get_flag(options::SECURITY_CONTEXT);
@@ -83,7 +83,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
8383
}
8484

8585
// Apply SMACK context if requested
86-
#[cfg(all(feature = "smack", target_os = "linux"))]
86+
#[cfg(smack)]
8787
{
8888
let set_security_context = matches.get_flag(options::SECURITY_CONTEXT);
8989
let context = matches.get_one::<String>(options::CONTEXT);

0 commit comments

Comments
 (0)