From 14417a5d2ac04fc5d80c95d3aa31a27b1fc4a0b3 Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Wed, 23 Jan 2019 13:52:48 -0800 Subject: Check that install file exists before unlink This will remove spurious error messages in logcat such as: 08-02 00:27:21.580 600 600 E /system/bin/recovery-persist: Failed to unlink /data/misc/recovery/last_install: No such file or directory since the install file doesn't exist in the first place. Bug: None Test: m Change-Id: Ifaa95729c50efae4e641286dfbe1718aceb5f50a --- recovery-persist.cpp | 4 ++-- 1 file 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; } } -- cgit v1.2.3 From 9ce1d14ef621459a4ac62ee1bda0b9f51cfa4c38 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Wed, 23 Jan 2019 20:46:20 -0800 Subject: DO NOT MERGE: Revert "Add libprocessgroup dependency" This reverts commit 62d0c7873cf81d63078b932edd23ae78677408cd. Reason for revert: Broke AOSP Change-Id: I88ef00ebce797f7fdca3678ab93fcae364453a8c Signed-off-by: Suren Baghdasaryan --- tests/Android.bp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Android.bp b/tests/Android.bp index 898ed7d60..1d6a056f6 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -29,7 +29,6 @@ cc_defaults { "libcutils", "liblog", "libpng", - "libprocessgroup", "libselinux", "libz", "libziparchive", -- cgit v1.2.3 From 0ca607c4cdb25d4265e3af0504487a0ca03ac5d3 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Fri, 25 Jan 2019 05:33:42 +0000 Subject: DO NOT MERGE: Revert "Revert "Add libprocessgroup dependency"" This reverts commit 9ce1d14ef621459a4ac62ee1bda0b9f51cfa4c38. Reason for revert: AOSP is fixed with new vendor image Change-Id: Ie5a9748acdae22a2b9862cb2ecedda7031f77264 Signed-off-by: Suren Baghdasaryan --- tests/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Android.bp b/tests/Android.bp index 1d6a056f6..898ed7d60 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -29,6 +29,7 @@ cc_defaults { "libcutils", "liblog", "libpng", + "libprocessgroup", "libselinux", "libz", "libziparchive", -- cgit v1.2.3