mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-27 15:20:58 +00:00
Allow calling remove_all on non-existence file
This commit is contained in:
@@ -407,7 +407,16 @@ impl Utf8CStr {
|
||||
// We should treat these as application logic and log ASAP, so return LoggedResult.
|
||||
impl Utf8CStr {
|
||||
pub fn remove_all(&self) -> LoggedResult<()> {
|
||||
let attr = self.get_attr()?;
|
||||
let attr = match self.get_attr() {
|
||||
Ok(attr) => attr,
|
||||
Err(e) => {
|
||||
return match e.errno {
|
||||
// Allow calling remove_all on non-existence file
|
||||
Errno::ENOENT => Ok(()),
|
||||
_ => Err(e)?,
|
||||
};
|
||||
}
|
||||
};
|
||||
if attr.is_dir() {
|
||||
let dir = Directory::open(self)?;
|
||||
dir.remove_all()?;
|
||||
|
||||
@@ -281,7 +281,7 @@ impl<T> LibcReturn for nix::Result<T> {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct OsError<'a> {
|
||||
errno: Errno,
|
||||
pub errno: Errno,
|
||||
name: &'static str,
|
||||
arg1: Option<&'a str>,
|
||||
arg2: Option<&'a str>,
|
||||
|
||||
Reference in New Issue
Block a user