diff options
author | Ng Zhi An <zhin@google.com> | 2019-01-24 06:54:11 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-01-24 06:54:11 +0100 |
commit | 737e6cc6000829094b4d2a5bffe1b227a07d11f8 (patch) | |
tree | 1bfcc933fd0638982b5071793f038caab9982b32 | |
parent | Merge "Add libprocessgroup dependency" am: 4475f7330a (diff) | |
parent | Merge "Check that install file exists before unlink" (diff) | |
download | android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.tar android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.tar.gz android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.tar.bz2 android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.tar.lz android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.tar.xz android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.tar.zst android_bootable_recovery-737e6cc6000829094b4d2a5bffe1b227a07d11f8.zip |
-rw-r--r-- | recovery-persist.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/recovery-persist.cpp b/recovery-persist.cpp index ebb42d223..e2a6699f6 100644 --- a/recovery-persist.cpp +++ b/recovery-persist.cpp @@ -158,7 +158,7 @@ int main(int argc, char **argv) { // Collects and reports the non-a/b update metrics from last_install; and removes the file // to avoid duplicate report. report_metrics_from_last_install(LAST_INSTALL_FILE_IN_CACHE); - if (unlink(LAST_INSTALL_FILE_IN_CACHE) == -1) { + if (access(LAST_INSTALL_FILE_IN_CACHE, F_OK) && unlink(LAST_INSTALL_FILE_IN_CACHE) == -1) { PLOG(ERROR) << "Failed to unlink " << LAST_INSTALL_FILE_IN_CACHE; } @@ -182,7 +182,7 @@ int main(int argc, char **argv) { // /data/misc/recovery from pmsg. Looks for the sideload history only. if (!has_cache) { report_metrics_from_last_install(LAST_INSTALL_FILE); - if (unlink(LAST_INSTALL_FILE) == -1) { + if (access(LAST_INSTALL_FILE, F_OK) && unlink(LAST_INSTALL_FILE) == -1) { PLOG(ERROR) << "Failed to unlink " << LAST_INSTALL_FILE; } } |