restorecon: set adb_file to system_file for module files
This commit is contained in:
@@ -61,11 +61,11 @@ pub fn restore_syscon<P: AsRef<Path>>(dir: P) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restore_syscon_if_unlabeled<P: AsRef<Path>>(dir: P) -> Result<()> {
|
fn restore_modules_con<P: AsRef<Path>>(dir: P) -> Result<()> {
|
||||||
for dir_entry in WalkDir::new(dir).parallelism(Serial) {
|
for dir_entry in WalkDir::new(dir).parallelism(Serial) {
|
||||||
if let Some(path) = dir_entry.ok().map(|dir_entry| dir_entry.path()) {
|
if let Some(path) = dir_entry.ok().map(|dir_entry| dir_entry.path()) {
|
||||||
if let anyhow::Result::Ok(con) = lgetfilecon(&path) {
|
if let Result::Ok(con) = lgetfilecon(&path) {
|
||||||
if con == UNLABEL_CON || con.is_empty() {
|
if con == ADB_CON || con == UNLABEL_CON || con.is_empty() {
|
||||||
lsetfilecon(&path, SYSTEM_CON)?;
|
lsetfilecon(&path, SYSTEM_CON)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,6 @@ fn restore_syscon_if_unlabeled<P: AsRef<Path>>(dir: P) -> Result<()> {
|
|||||||
|
|
||||||
pub fn restorecon() -> Result<()> {
|
pub fn restorecon() -> Result<()> {
|
||||||
lsetfilecon(defs::DAEMON_PATH, ADB_CON)?;
|
lsetfilecon(defs::DAEMON_PATH, ADB_CON)?;
|
||||||
restore_syscon_if_unlabeled(defs::MODULE_DIR)?;
|
restore_modules_con(defs::MODULE_DIR)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user