vold: asec path cmd now returns OpFailedStorageNotFound if id doesn't exist
Change-Id: Icbe3de7c28505f7496c8f8edea126c7b616de475
Signed-off-by: San Mehat <san@google.com>
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 7a44e2e..c72482e 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -195,6 +195,14 @@
}
int VolumeManager::getAsecMountPath(const char *id, char *buffer, int maxlen) {
+ char asecFileName[255];
+ snprintf(asecFileName, sizeof(asecFileName), "%s/%s.asec", Volume::SEC_ASECDIR, id);
+
+ memset(buffer, 0, maxlen);
+ if (access(asecFileName, F_OK)) {
+ errno = ENOENT;
+ return -1;
+ }
snprintf(buffer, maxlen, "%s/%s", Volume::ASECDIR, id);
return 0;