summaryrefslogtreecommitdiffstats
path: root/cmds/dumpstate
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2012-04-06 09:31:28 -0700
committerNick Kralevich <nnk@google.com>2012-04-06 09:46:10 -0700
commitc7f1fe26804ab986b90f3ba007db94f71e94932a (patch)
tree5e8a8fb0af0b5cdf878c9fd861f5173617ce518a /cmds/dumpstate
parent3eb38cb33e41ce40dd1094bdec850f0fca9f8a53 (diff)
downloadframeworks_native-c7f1fe26804ab986b90f3ba007db94f71e94932a.zip
frameworks_native-c7f1fe26804ab986b90f3ba007db94f71e94932a.tar.gz
frameworks_native-c7f1fe26804ab986b90f3ba007db94f71e94932a.tar.bz2
Ensure that /data/anr/traces.txt is world-writable
The umask changed for init. We have to force /data/anr to be world readble and /data/anr/traces.txt to be world writable so dalvik processes can write to it. Hopefully this is a short term change while we investigate tightening up these permissions. Bug: 6300296 Change-Id: Iacb4c9f1bc69d2ac679697f9cf9a52694f888489
Diffstat (limited to 'cmds/dumpstate')
-rw-r--r--cmds/dumpstate/utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index 0d5ab90..25505f8 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -375,6 +375,7 @@ const char *dump_vm_traces() {
*slash = '\0';
if (!mkdir(anr_traces_dir, 0775)) {
chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM);
+ chmod(anr_traces_dir, 0775);
} else if (errno != EEXIST) {
fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno));
return NULL;
@@ -387,6 +388,12 @@ const char *dump_vm_traces() {
fprintf(stderr, "%s: %s\n", traces_path, strerror(errno));
return NULL;
}
+ int chmod_ret = fchmod(fd, 0666);
+ if (chmod_ret < 0) {
+ fprintf(stderr, "fchmod on %s failed: %s\n", traces_path, strerror(errno));
+ close(fd);
+ return NULL;
+ }
close(fd);
/* walk /proc and kill -QUIT all Dalvik processes */