@@ -63,10 +63,9 @@ macro_rules! cstr2cow {
6363}
6464
6565fn get_context_help_text ( ) -> String {
66- #[ cfg( any(
67- all( feature = "selinux" , any( target_os = "android" , target_os = "linux" ) ) ,
68- all( feature = "smack" , target_os = "linux" ) ,
69- ) ) ]
66+ #[ cfg( not( any( selinux, smack) ) ) ]
67+ return translate ! ( "id-context-help-disabled" ) ;
68+ #[ cfg( any( selinux, smack) ) ]
7069 return translate ! ( "id-context-help-enabled" ) ;
7170
7271 #[ cfg( not( any(
@@ -106,9 +105,9 @@ struct State {
106105 rflag : bool , // --real
107106 zflag : bool , // --zero
108107 cflag : bool , // --context
109- #[ cfg( all ( feature = " selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
108+ #[ cfg( selinux) ]
110109 selinux_supported : bool ,
111- #[ cfg( all ( feature = " smack" , target_os = "linux" ) ) ]
110+ #[ cfg( smack) ]
112111 smack_supported : bool ,
113112 ids : Option < Ids > ,
114113 // The behavior for calling GNU's `id` and calling GNU's `id $USER` is similar but different.
@@ -147,9 +146,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
147146 rflag : matches. get_flag ( options:: OPT_REAL_ID ) ,
148147 zflag : matches. get_flag ( options:: OPT_ZERO ) ,
149148 cflag : matches. get_flag ( options:: OPT_CONTEXT ) ,
150- #[ cfg( all ( feature = " selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
149+ #[ cfg( selinux) ]
151150 selinux_supported : uucore:: selinux:: is_selinux_enabled ( ) ,
152- #[ cfg( all ( feature = " smack" , target_os = "linux" ) ) ]
151+ #[ cfg( smack) ]
153152 smack_supported : uucore:: smack:: is_smack_enabled ( ) ,
154153 user_specified : !users. is_empty ( ) ,
155154 ids : None ,
@@ -185,7 +184,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
185184
186185 if state. cflag {
187186 // SELinux context
188- #[ cfg( all ( feature = " selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
187+ #[ cfg( selinux) ]
189188 if state. selinux_supported {
190189 if let Ok ( context) = selinux:: SecurityContext :: current ( false ) {
191190 let bytes = context. as_bytes ( ) ;
@@ -199,7 +198,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
199198 }
200199
201200 // SMACK label
202- #[ cfg( all ( feature = " smack" , target_os = "linux" ) ) ]
201+ #[ cfg( smack) ]
203202 if state. smack_supported {
204203 match uucore:: smack:: get_smack_label_for_self ( ) {
205204 Ok ( label) => {
@@ -711,7 +710,7 @@ fn id_print(state: &State, groups: &[u32]) -> io::Result<()> {
711710 . join( "," )
712711 ) ?;
713712
714- #[ cfg( all ( feature = " selinux" , any ( target_os = "linux" , target_os = "android" ) ) ) ]
713+ #[ cfg( selinux) ]
715714 if state. selinux_supported
716715 && !state. user_specified
717716 && std:: env:: var_os ( "POSIXLY_CORRECT" ) . is_none ( )
@@ -723,7 +722,7 @@ fn id_print(state: &State, groups: &[u32]) -> io::Result<()> {
723722 }
724723 }
725724
726- #[ cfg( all ( feature = " smack" , target_os = "linux" ) ) ]
725+ #[ cfg( smack) ]
727726 if state. smack_supported
728727 && !state. user_specified
729728 && std:: env:: var_os ( "POSIXLY_CORRECT" ) . is_none ( )
0 commit comments