Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e755e96 authored by Bob Lee's avatar Bob Lee Committed by Android Git Automerger
Browse files

am b97d616d: am d62ae8f1: Merge change 24061 into eclair

Merge commit 'b97d616d'

* commit 'b97d616d':
  Added a hack that makes the SD card world-writable when the sampling
parents 3ae1aa06 b97d616d
Loading
Loading
Loading
Loading
+23 −7
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <errno.h>

#include <sys/mount.h>
#include <cutils/properties.h>

#include "vold.h"
#include "volmgr.h"
@@ -107,6 +108,20 @@ int vfat_mount(blkdev_t *dev, volume_t *vol, boolean safe_mode)
        flags |= MS_REMOUNT;
    }

    /*
     * Note: This is a temporary hack. If the sampling profiler is enabled,
     * we make the SD card world-writable so any process can write snapshots.
     *
     * TODO: Remove this code once we have a drop box in system_server.
     */
    char value[PROPERTY_VALUE_MAX];
    property_get("persist.sampling_profiler", value, "");
    if (value[0] == '1') {
        LOGW("The SD card is world-writable because the"
            " 'persist.sampling_profiler' system property is set to '1'.");
        rc = mount(devpath, vol->mount_point, "vfat", flags,
                "utf8,uid=1000,gid=1015,fmask=000,dmask=000,shortname=mixed");
    } else {
        /*
         * The mount masks restrict access so that:
         * 1. The 'system' user cannot access the SD card at all -
@@ -116,6 +131,7 @@ int vfat_mount(blkdev_t *dev, volume_t *vol, boolean safe_mode)
         */
        rc = mount(devpath, vol->mount_point, "vfat", flags,
                "utf8,uid=1000,gid=1015,fmask=702,dmask=702,shortname=mixed");
    }

    if (rc && errno == EROFS) {
        LOGE("vfat_mount(%d:%d, %s): Read only filesystem - retrying mount RO",