mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-07-29 19:23:39 +00:00
Don't clone attributes for magisk symlinks
This avoids use existing attributes for su, which will obviously break magisk functions.
This commit is contained in:
parent
58b405bce1
commit
3a37e8c9c5
@ -92,7 +92,7 @@ impl Drop for PathTracker<'_> {
|
|||||||
enum FsNode {
|
enum FsNode {
|
||||||
Directory { children: FsNodeMap },
|
Directory { children: FsNodeMap },
|
||||||
File { src: Utf8CString },
|
File { src: Utf8CString },
|
||||||
Symlink { target: Utf8CString },
|
Symlink { target: Utf8CString, is_magisk_bin: bool },
|
||||||
Whiteout,
|
Whiteout,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +125,7 @@ impl FsNode {
|
|||||||
.entry(entry.name().to_string())
|
.entry(entry.name().to_string())
|
||||||
.or_insert_with(|| FsNode::Symlink {
|
.or_insert_with(|| FsNode::Symlink {
|
||||||
target: link.to_owned(),
|
target: link.to_owned(),
|
||||||
|
is_magisk_bin: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if entry.is_char_device() {
|
if entry.is_char_device() {
|
||||||
@ -277,6 +278,7 @@ impl FsNode {
|
|||||||
entry.name().to_string(),
|
entry.name().to_string(),
|
||||||
FsNode::Symlink {
|
FsNode::Symlink {
|
||||||
target: link.to_owned(),
|
target: link.to_owned(),
|
||||||
|
is_magisk_bin: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -297,10 +299,11 @@ impl FsNode {
|
|||||||
}
|
}
|
||||||
mount_dummy("mount", src, path.tmp, false)?;
|
mount_dummy("mount", src, path.tmp, false)?;
|
||||||
}
|
}
|
||||||
FsNode::Symlink { target } => {
|
FsNode::Symlink { target, is_magisk_bin } => {
|
||||||
module_log!("mklink", path.tmp, target);
|
module_log!("mklink", path.tmp, target);
|
||||||
path.tmp.create_symlink_to(target)?;
|
path.tmp.create_symlink_to(target)?;
|
||||||
if path.real.exists() {
|
// Avoid cloneing existing su attributes to our su
|
||||||
|
if !*is_magisk_bin && path.real.exists() {
|
||||||
clone_attr(path.real, path.tmp)?;
|
clone_attr(path.real, path.tmp)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,18 +351,21 @@ fn inject_magisk_bins(system: &mut FsNode) {
|
|||||||
"su".to_string(),
|
"su".to_string(),
|
||||||
FsNode::Symlink {
|
FsNode::Symlink {
|
||||||
target: Utf8CString::from("./magisk"),
|
target: Utf8CString::from("./magisk"),
|
||||||
|
is_magisk_bin: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
children.insert(
|
children.insert(
|
||||||
"resetprop".to_string(),
|
"resetprop".to_string(),
|
||||||
FsNode::Symlink {
|
FsNode::Symlink {
|
||||||
target: Utf8CString::from("./magisk"),
|
target: Utf8CString::from("./magisk"),
|
||||||
|
is_magisk_bin: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
children.insert(
|
children.insert(
|
||||||
"supolicy".to_string(),
|
"supolicy".to_string(),
|
||||||
FsNode::Symlink {
|
FsNode::Symlink {
|
||||||
target: Utf8CString::from("./magiskpolicy"),
|
target: Utf8CString::from("./magiskpolicy"),
|
||||||
|
is_magisk_bin: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user