vold2: Fix issue with destroying / unmounting asec
Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
parent
dfe79492a4
commit
0586d54053
2 changed files with 14 additions and 5 deletions
|
@ -190,7 +190,9 @@ int Devmapper::destroy(const char *name) {
|
|||
ioctlInit(io, 4096, name, 0);
|
||||
|
||||
if (ioctl(fd, DM_DEV_REMOVE, io)) {
|
||||
if (errno != ENXIO) {
|
||||
LOGE("Error destroying device mapping (%s)", strerror(errno));
|
||||
}
|
||||
free(buffer);
|
||||
close(fd);
|
||||
return -1;
|
||||
|
|
|
@ -293,7 +293,7 @@ int VolumeManager::unmountAsec(const char *id) {
|
|||
"/sdcard/android_secure/%s.asec", id);
|
||||
snprintf(mountPoint, sizeof(mountPoint), "/asec/%s", id);
|
||||
|
||||
if (isMountpointMounted(mountPoint)) {
|
||||
if (!isMountpointMounted(mountPoint)) {
|
||||
LOGE("Unmount request for ASEC %s when not mounted", id);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
|
@ -343,10 +343,17 @@ int VolumeManager::destroyAsec(const char *id) {
|
|||
"/sdcard/android_secure/%s.asec", id);
|
||||
snprintf(mountPoint, sizeof(mountPoint), "/asec/%s", id);
|
||||
|
||||
if (unmountAsec(id))
|
||||
if (isMountpointMounted(mountPoint)) {
|
||||
if (unmountAsec(id)) {
|
||||
LOGE("Failed to unmount asec %s for destroy (%s)", id, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
unlink(asecFileName);
|
||||
if (unlink(asecFileName)) {
|
||||
LOGE("Failed to unlink asec %s (%s)", id, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOGD("ASEC %s destroyed", id);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue