Don't skip backup even if original does not exist

Close #5945, fix #5944
This commit is contained in:
topjohnwu 2022-06-08 03:58:15 -07:00
parent e2f3753551
commit 7bf9c74216

View File

@ -142,15 +142,13 @@ void magisk_cpio::restore() {
} }
void magisk_cpio::backup(const char *orig) { void magisk_cpio::backup(const char *orig) {
if (access(orig, R_OK))
return;
entry_map backups; entry_map backups;
string rm_list; string rm_list;
backups.emplace(".backup", new cpio_entry(S_IFDIR)); backups.emplace(".backup", new cpio_entry(S_IFDIR));
magisk_cpio o; magisk_cpio o;
o.load_cpio(orig); if (access(orig, R_OK) == 0)
o.load_cpio(orig);
// Remove existing backups in original ramdisk // Remove existing backups in original ramdisk
o.rm(".backup", true); o.rm(".backup", true);