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(()) }