summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-01-27 05:11:30 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-01-27 05:11:30 +0100
commitcdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631 (patch)
tree1998d04b8bffbe24dc07670c0b65d5b4979cd981
parentSnap for 5251505 from 734dd91a485ca33adb914074baf5439a58aed0f7 to qt-release (diff)
parent[automerger skipped] Merge "DO NOT MERGE: Revert "Revert "Add libprocessgroup dependency""" am: 5342de92e0 -s ours am: 2b8e48240e -s ours (diff)
downloadandroid_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.tar
android_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.tar.gz
android_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.tar.bz2
android_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.tar.lz
android_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.tar.xz
android_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.tar.zst
android_bootable_recovery-cdc115be5e7ee8be2c3bb0bd29b54f70ffc6c631.zip
-rw-r--r--recovery-persist.cpp4
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;
}
}