vold: Prohibit container rename when dst container is mounted
Signed-off-by: San Mehat <san@google.com>
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 8e0165c..0aa8c51 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -298,6 +298,13 @@
goto out_err;
}
+ snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id2);
+ if (isMountpointMounted(mountPoint)) {
+ LOGW("Rename attempt when dst mounted");
+ errno = EBUSY;
+ goto out_err;
+ }
+
if (!access(asecFilename2, F_OK)) {
LOGE("Rename attempt when dst exists");
errno = EADDRINUSE;