Don't fail if a key we want to delete is already deleted
This can happen when cleaning up stale users at boot time.
Bug: 30158800
Change-Id: I2733d8d525fc79b7f05eb2225b7e6e14c4da277f
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 09c33a0..7d65364 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -534,7 +534,12 @@
for (auto const path: get_ce_key_paths(get_ce_key_directory_path(user_id))) {
success &= android::vold::destroyKey(path);
}
- success &= android::vold::destroyKey(get_de_key_path(user_id));
+ auto de_key_path = get_de_key_path(user_id);
+ if (path_exists(de_key_path)) {
+ success &= android::vold::destroyKey(de_key_path);
+ } else {
+ LOG(INFO) << "Not present so not erasing: " << de_key_path;
+ }
}
return success;
}