summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2022-08-26 14:35:38 +0100
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-08-26 15:17:28 +0000
commit5c5cce9938d24e7e27c65ab975b58923ee495610 (patch)
tree309d51a6eade793ff3c697440e6a2cb36b007504
parent18f0c4ead1cd7e476cf5b033fe959260c9765dde (diff)
Ignore the error when deleting the root directory during cleanup.
Bug: 238428111 Test: Presubmit Change-Id: Idcd7d3b3bc6fc1d416e01863ab1d06cb0e76adcf
-rw-r--r--odrefresh/odr_fs_utils.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/odrefresh/odr_fs_utils.cc b/odrefresh/odr_fs_utils.cc
index 22cc1b6a5d..3ed8021037 100644
--- a/odrefresh/odr_fs_utils.cc
+++ b/odrefresh/odr_fs_utils.cc
@@ -68,9 +68,12 @@ WARN_UNUSED bool RemoveDirectory(const std::string& dir_path) {
}
if (rmdir(dir_path.c_str()) != 0) {
- LOG(ERROR) << "Failed to delete '" << dir_path << "'";
- return false;
+ // It's possible that we are not able to remove the directory itself. For example, when
+ // odrefresh is running in CompOS, the staging dir is prepared beforehand passed to the VM as an
+ // FD. In this case, just log and ignore the error. It's okay to keep the directory.
+ LOG(WARNING) << "Failed to delete '" << dir_path << "'";
}
+
return true;
}