File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,10 @@ impl Drop for SetEnforceGuard {
84
84
#[ context( "Ensuring selinux install_t type" ) ]
85
85
#[ cfg( feature = "install" ) ]
86
86
pub ( crate ) fn selinux_ensure_install_or_setenforce ( ) -> Result < Option < SetEnforceGuard > > {
87
+ // If the process already has install_t, exit early
88
+ if self_has_install_t ( ) ? {
89
+ return Ok ( None ) ;
90
+ }
87
91
selinux_ensure_install ( ) ?;
88
92
let current = std:: fs:: read_to_string ( "/proc/self/attr/current" )
89
93
. context ( "Reading /proc/self/attr/current" ) ?;
@@ -170,3 +174,10 @@ pub(crate) fn xattrs_have_selinux(xattrs: &ostree::glib::Variant) -> bool {
170
174
}
171
175
false
172
176
}
177
+
178
+ fn self_has_install_t ( ) -> Result < bool > {
179
+ let current = std:: fs:: read_to_string ( "/proc/self/attr/current" )
180
+ . context ( "Reading /proc/self/attr/current" ) ?;
181
+
182
+ Ok ( current. contains ( "install_t" ) )
183
+ }
You can’t perform that action at this time.
0 commit comments