Don't abort the encryption process if an internal volume is present but unmounted.
It is not a failure if the SD card is not mounted.
Change-Id: If954f77c55ac124b9b7b39c89ffbafb4e5ea9e98
diff --git a/cryptfs.c b/cryptfs.c
index 8b5f523..0d3c681 100644
--- a/cryptfs.c
+++ b/cryptfs.c
@@ -1062,7 +1062,7 @@
unsigned long mnt_flags, nr_sec;
unsigned char master_key[KEY_LEN_BYTES], decrypted_master_key[KEY_LEN_BYTES];
unsigned char salt[SALT_LEN];
- int rc=-1, fd, i;
+ int rc=-1, fd, i, ret;
struct crypt_mnt_ftr crypt_ftr, sd_crypt_ftr;;
char tmpfs_options[PROPERTY_VALUE_MAX];
char encrypted_state[PROPERTY_VALUE_MAX];
@@ -1141,7 +1141,10 @@
}
close(fd);
- if (vold_unmountVol(vol_list[i].label)) {
+ ret=vold_unmountVol(vol_list[i].label);
+ if ((ret < 0) && (ret != UNMOUNT_NOT_MOUNTED_ERR)) {
+ /* -2 is returned when the device exists but is not currently mounted.
+ * ignore the error and continue. */
SLOGE("Failed to unmount volume %s\n", vol_list[i].label);
goto error_unencrypted;
}