summaryrefslogtreecommitdiff
path: root/artd
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2023-04-25 11:48:37 +0100
committer Jiakai Zhang <jiakaiz@google.com> 2023-04-28 09:16:07 +0000
commitcddee79d14036a337dd2d9fb7882fb1da2fe42eb (patch)
tree9be770c0ec73fde5289826fde6b0256e32bf8842 /artd
parent4b96ee08479adf09d3524e78944af28de1b514b8 (diff)
Don't log error when deleting a file that doesn't exist.
Similar to commit 9b2bddc732b8a09b7091f983ee8161f1db277cae, but for another method. Bug: 261431149 Test: - 1. Add a "sleep" between artd invoking dex2oat and moving the files. 2. Install an app. 3. Run "pm compile" on the app. 4. While "pm compile" is on "sleep", uninstall the app. 5. See no message like "Failed to remove file '...': Success". Ignore-AOSP-First: ART Services Change-Id: I274457b892bcb2426fc5e01470212597f63c8323
Diffstat (limited to 'artd')
-rw-r--r--artd/file_utils.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/artd/file_utils.cc b/artd/file_utils.cc
index 0ce782a7e9..fb55dec5d5 100644
--- a/artd/file_utils.cc
+++ b/artd/file_utils.cc
@@ -50,10 +50,9 @@ using ::fmt::literals::operator""_format; // NOLINT
void UnlinkIfExists(const std::string& path) {
std::error_code ec;
- if (!std::filesystem::remove(path, ec)) {
- if (ec.value() != ENOENT) {
- LOG(WARNING) << "Failed to remove file '{}': {}"_format(path, ec.message());
- }
+ std::filesystem::remove(path, ec);
+ if (ec) {
+ LOG(WARNING) << "Failed to remove file '{}': {}"_format(path, ec.message());
}
}