vold2: Fix issue with destroying / unmounting asec

Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
San Mehat 2010-01-12 15:38:59 -08:00
parent dfe79492a4
commit 0586d54053
2 changed files with 14 additions and 5 deletions

View file

@ -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;

View file

@ -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;