diff options
author | Brian Swetland <swetland@google.com> | 2010-08-12 18:21:12 -0700 |
---|---|---|
committer | Brian Swetland <swetland@google.com> | 2010-08-12 18:22:23 -0700 |
commit | b14a2c6e34b197870433386fb809d34b58b30fc0 (patch) | |
tree | 4707a4bb32242be03893d2f0dab07651c8ae0e61 | |
parent | 03ee9479a4ed67689b9bbccda20c60800a38b178 (diff) | |
download | core-b14a2c6e34b197870433386fb809d34b58b30fc0.tar.gz |
fix up permissions
Change-Id: I93c828ebc755ad2a2055066c8af65dfde7dc7b2e
-rw-r--r-- | sdcard/sdcard.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c index 5d1960451..a534dae8d 100644 --- a/sdcard/sdcard.c +++ b/sdcard/sdcard.c @@ -25,6 +25,8 @@ #include <sys/uio.h> #include <dirent.h> +#include <private/android_filesystem_config.h> + #include "fuse.h" /* README @@ -144,10 +146,20 @@ void attr_from_stat(struct fuse_attr *attr, struct stat *s) /* TODO: time */ attr->mode = s->st_mode; attr->nlink = s->st_nlink; - /* TODO: uid/gid */ - attr->uid = 1000; - attr->gid = 1000; + /* force permissions to something reasonable: + * world readable + * writable by the sdcard group + */ + if (attr->mode & 0100) { + attr->mode = (attr->mode & (~0777)) | 0775; + } else { + attr->mode = (attr->mode & (~0777)) | 0664; + } + + /* all files owned by root.sdcard */ + attr->uid = 0; + attr->gid = AID_SDCARD_RW; } int node_get_attr(struct node *node, struct fuse_attr *attr) |