summaryrefslogtreecommitdiffstats
path: root/Volume.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-23 14:55:49 -0400
committerMike Lockwood <lockwood@android.com>2011-03-25 13:42:56 -0700
commit9092b1dbd31406f6939045fbef70a297b8dbeb62 (patch)
tree0211dc08ae68d84f908b2cf3d4ec05f338155a2b /Volume.cpp
parentad2ac33460d6ee1436b68bab1f820e3b6d3efeb4 (diff)
downloadsystem_vold-9092b1dbd31406f6939045fbef70a297b8dbeb62.zip
system_vold-9092b1dbd31406f6939045fbef70a297b8dbeb62.tar.gz
system_vold-9092b1dbd31406f6939045fbef70a297b8dbeb62.tar.bz2
Mount secondary external storage writable by AID_MEDIA_RW rather than AID_SDCARD_RW
Change-Id: I8bb658bb2ab66026f0a54f9c1f80fc5c6e8d918a Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'Volume.cpp')
-rw-r--r--Volume.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Volume.cpp b/Volume.cpp
index d67a6c4..746d84f 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -33,6 +33,8 @@
#include <diskconfig/diskconfig.h>
+#include <private/android_filesystem_config.h>
+
#define LOG_TAG "Vold"
#include <cutils/log.h>
@@ -336,8 +338,18 @@ int Volume::mountVol() {
* muck with it before exposing it to non priviledged users.
*/
errno = 0;
+ int gid;
+
+ if (!strcmp(getMountpoint(), "/mnt/sdcard")) {
+ // Special case the primary SD card.
+ // For this we grant write access to the SDCARD_RW group.
+ gid = AID_SDCARD_RW;
+ } else {
+ // For secondary external storage we keep things locked up.
+ gid = AID_MEDIA_RW;
+ }
if (Fat::doMount(devicePath, "/mnt/secure/staging", false, false, false,
- 1000, 1015, 0702, true)) {
+ AID_SYSTEM, gid, 0702, true)) {
SLOGE("%s failed to mount via VFAT (%s)\n", devicePath, strerror(errno));
continue;
}