From f10483ffa34a693a53ec7a0db1af0d1f9d883aa3 Mon Sep 17 00:00:00 2001 From: 5ec1cff Date: Fri, 22 Nov 2024 17:21:28 +0800 Subject: [PATCH] restorecon: set adb_file to system_file for module files --- userspace/ksud/src/restorecon.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/userspace/ksud/src/restorecon.rs b/userspace/ksud/src/restorecon.rs index 7656357e..91ccfb11 100644 --- a/userspace/ksud/src/restorecon.rs +++ b/userspace/ksud/src/restorecon.rs @@ -61,11 +61,11 @@ pub fn restore_syscon>(dir: P) -> Result<()> { Ok(()) } -fn restore_syscon_if_unlabeled>(dir: P) -> Result<()> { +fn restore_modules_con>(dir: P) -> Result<()> { for dir_entry in WalkDir::new(dir).parallelism(Serial) { if let Some(path) = dir_entry.ok().map(|dir_entry| dir_entry.path()) { - if let anyhow::Result::Ok(con) = lgetfilecon(&path) { - if con == UNLABEL_CON || con.is_empty() { + if let Result::Ok(con) = lgetfilecon(&path) { + if con == ADB_CON || con == UNLABEL_CON || con.is_empty() { lsetfilecon(&path, SYSTEM_CON)?; } } @@ -76,6 +76,6 @@ fn restore_syscon_if_unlabeled>(dir: P) -> Result<()> { pub fn restorecon() -> Result<()> { lsetfilecon(defs::DAEMON_PATH, ADB_CON)?; - restore_syscon_if_unlabeled(defs::MODULE_DIR)?; + restore_modules_con(defs::MODULE_DIR)?; Ok(()) }