From 7bf9c74216b7551092da1231f2a5bc3f22c54412 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 8 Jun 2022 03:58:15 -0700 Subject: [PATCH] Don't skip backup even if original does not exist Close #5945, fix #5944 --- native/jni/boot/ramdisk.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/native/jni/boot/ramdisk.cpp b/native/jni/boot/ramdisk.cpp index b68359cdc..b2b7dd921 100644 --- a/native/jni/boot/ramdisk.cpp +++ b/native/jni/boot/ramdisk.cpp @@ -142,15 +142,13 @@ void magisk_cpio::restore() { } void magisk_cpio::backup(const char *orig) { - if (access(orig, R_OK)) - return; - entry_map backups; string rm_list; backups.emplace(".backup", new cpio_entry(S_IFDIR)); magisk_cpio o; - o.load_cpio(orig); + if (access(orig, R_OK) == 0) + o.load_cpio(orig); // Remove existing backups in original ramdisk o.rm(".backup", true);