Merge "allow dumpstate to work for non-root users." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
62d0970c82
@ -216,6 +216,7 @@ int main(int argc, char *argv[]) {
|
|||||||
fclose(cmdline);
|
fclose(cmdline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getuid() == 0) {
|
||||||
/* switch to non-root user and group */
|
/* switch to non-root user and group */
|
||||||
gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT };
|
gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT };
|
||||||
if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
|
if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
|
||||||
@ -230,6 +231,7 @@ int main(int argc, char *argv[]) {
|
|||||||
LOGE("Unable to setuid, aborting: %s\n", strerror(errno));
|
LOGE("Unable to setuid, aborting: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char path[PATH_MAX], tmp_path[PATH_MAX];
|
char path[PATH_MAX], tmp_path[PATH_MAX];
|
||||||
pid_t gzip_pid = -1;
|
pid_t gzip_pid = -1;
|
||||||
|
Reference in New Issue
Block a user