Skip symlink in restore_tmpcon()

If magisktmp is /sbin, there may exist files which is symlink to files in
root dir. As root is RO, setcontext will fail and break iterating loop.
This commit is contained in:
Wang Han 2025-06-16 21:29:17 +08:00 committed by John Wu
parent 1460317ebd
commit 39f2940bd1

View File

@ -83,9 +83,11 @@ pub(crate) fn restore_tmpcon() -> LoggedResult<()> {
let mut path = cstr::buf::default();
let mut dir = Directory::open(tmp)?;
while let Some(ref e) = dir.read()? {
if !e.is_symlink() {
e.resolve_path(&mut path)?;
path.set_secontext(SYSTEM_CON)?;
}
}
path.clear();
path.append_path(tmp).append_path(LOG_PIPE);