diff options
author | Nick Kralevich <nnk@google.com> | 2010-09-01 17:03:28 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-01 17:03:28 -0700 |
commit | b089a09764aebfdae824fd22ec77190c0ee62dcf (patch) | |
tree | 9a5584cdff15d6a405e22aedae7d7b3337c5938a /cmds | |
parent | d79de7bc360a81feb12f8d0c9bb6c4aff92f9de1 (diff) | |
parent | b4de2f997591d3ee5f1eff92fbf2d4628cee5f2c (diff) | |
download | frameworks_base-b089a09764aebfdae824fd22ec77190c0ee62dcf.zip frameworks_base-b089a09764aebfdae824fd22ec77190c0ee62dcf.tar.gz frameworks_base-b089a09764aebfdae824fd22ec77190c0ee62dcf.tar.bz2 |
am b4de2f99: am 05f0382b: When dropping privileges, check return values.
Merge commit 'b4de2f997591d3ee5f1eff92fbf2d4628cee5f2c'
* commit 'b4de2f997591d3ee5f1eff92fbf2d4628cee5f2c':
When dropping privileges, check return values.
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/dumpstate/dumpstate.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index 267a9a7..a09666e 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -241,8 +241,18 @@ int main(int argc, char *argv[]) { /* switch to non-root user and group */ gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT }; - setgroups(sizeof(groups)/sizeof(groups[0]), groups); - setuid(AID_SHELL); + if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { + LOGE("Unable to setgroups, aborting: %s\n", strerror(errno)); + return -1; + } + if (setgid(AID_SHELL) != 0) { + LOGE("Unable to setgid, aborting: %s\n", strerror(errno)); + return -1; + } + if (setuid(AID_SHELL) != 0) { + LOGE("Unable to setuid, aborting: %s\n", strerror(errno)); + return -1; + } char path[PATH_MAX], tmp_path[PATH_MAX]; pid_t gzip_pid = -1; |