Don't fail on unlock if we're not even emulating FBE
As a precaution, we do the work of emulating an unlock even on devices
that aren't emulating FBE. However, we don't care if it fails, so
don't fail the calling command in that instance.
Bug: 26713622
Change-Id: I8c5fb4b9a130335ecbb9b8ea6367f1c59835c0f1
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 5523363..d00a7f7 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -696,12 +696,14 @@
static int emulated_unlock(const std::string& path, mode_t mode) {
if (chmod(path.c_str(), mode) != 0) {
PLOG(ERROR) << "Failed to chmod " << path;
- return -1;
+ // FIXME temporary workaround for b/26713622
+ if (e4crypt_is_emulated()) return -1;
}
#if EMULATED_USES_SELINUX
if (selinux_android_restorecon(path.c_str(), SELINUX_ANDROID_RESTORECON_FORCE) != 0) {
PLOG(WARNING) << "Failed to restorecon " << path;
- return -1;
+ // FIXME temporary workaround for b/26713622
+ if (e4crypt_is_emulated()) return -1;
}
#endif
return 0;