summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-12 15:38:59 -0800
committerSan Mehat <san@google.com>2010-01-12 15:38:59 -0800
commit0586d54053ee00e6d6523d4f125282ccb9a24aab (patch)
treea4ab1d9721cceace7f5b6a3797e2926f9c3a2e60
parentdfe79492a4f5280e9de2db6fa749a7781c59f2a6 (diff)
downloadsystem_vold-0586d54053ee00e6d6523d4f125282ccb9a24aab.tar.gz
system_vold-0586d54053ee00e6d6523d4f125282ccb9a24aab.tar.bz2
system_vold-0586d54053ee00e6d6523d4f125282ccb9a24aab.zip
vold2: Fix issue with destroying / unmounting asec
Signed-off-by: San Mehat <san@google.com>
-rw-r--r--Devmapper.cpp4
-rw-r--r--VolumeManager.cpp15
2 files changed, 14 insertions, 5 deletions
diff --git a/Devmapper.cpp b/Devmapper.cpp
index 74ed4fb..9dd8ef3 100644
--- a/Devmapper.cpp
+++ b/Devmapper.cpp
@@ -190,7 +190,9 @@ int Devmapper::destroy(const char *name) {
ioctlInit(io, 4096, name, 0);
if (ioctl(fd, DM_DEV_REMOVE, io)) {
- LOGE("Error destroying device mapping (%s)", strerror(errno));
+ if (errno != ENXIO) {
+ LOGE("Error destroying device mapping (%s)", strerror(errno));
+ }
free(buffer);
close(fd);
return -1;
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 9bdc980..596590d 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -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))
- return -1;
+ 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;