From 745ddcb2a6247817dde0790be4c74a81e7b324d4 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Fri, 25 Mar 2011 12:37:43 -0700 Subject: [PATCH] DO NOT MERGE Only create android_secure mountpoint on the primary external storage volume. Change-Id: If2532ce8ca7d584f2442d830450313198234bd23 Signed-off-by: Mike Lockwood --- Volume.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Volume.cpp b/Volume.cpp index 746d84f..ce41455 100644 --- a/Volume.cpp +++ b/Volume.cpp @@ -282,6 +282,8 @@ int Volume::mountVol() { dev_t deviceNodes[4]; int n, i, rc = 0; char errmsg[255]; + const char* externalStorage = getenv("EXTERNAL_STORAGE"); + bool primaryStorage = externalStorage && !strcmp(getMountpoint(), externalStorage); if (getState() == Volume::State_NoMedia) { snprintf(errmsg, sizeof(errmsg), @@ -340,7 +342,7 @@ int Volume::mountVol() { errno = 0; int gid; - if (!strcmp(getMountpoint(), "/mnt/sdcard")) { + if (primaryStorage) { // Special case the primary SD card. // For this we grant write access to the SDCARD_RW group. gid = AID_SDCARD_RW; @@ -358,7 +360,8 @@ int Volume::mountVol() { protectFromAutorunStupidity(); - if (createBindMounts()) { + // only create android_secure on primary storage + if (primaryStorage && createBindMounts()) { SLOGE("Failed to create bindmounts (%s)", strerror(errno)); umount("/mnt/secure/staging"); setState(Volume::State_Idle);