diff options
author | Nick Kralevich <nnk@google.com> | 2010-08-27 18:10:24 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-27 18:10:24 -0700 |
commit | 9abea13a0a5015a401c15ad6a2a1db1b337d9cdf (patch) | |
tree | bdea3e5db4423dda798e8c6f77275263bc9c91b3 /adb | |
parent | bc4d60af3ce2f4d08069992ef6bbfa2e2ad063a5 (diff) | |
parent | 4692599cf73240e34d8e3bf7f54e99ebb9c0aaf3 (diff) | |
download | system_core-9abea13a0a5015a401c15ad6a2a1db1b337d9cdf.zip system_core-9abea13a0a5015a401c15ad6a2a1db1b337d9cdf.tar.gz system_core-9abea13a0a5015a401c15ad6a2a1db1b337d9cdf.tar.bz2 |
am 4692599c: am 44db990d: Fix bug 2950316. Check return values.
Merge commit '4692599cf73240e34d8e3bf7f54e99ebb9c0aaf3'
* commit '4692599cf73240e34d8e3bf7f54e99ebb9c0aaf3':
Fix bug 2950316. Check return values.
Diffstat (limited to 'adb')
-rw-r--r-- | adb/adb.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -893,7 +893,9 @@ int adb_main(int is_daemon, int server_port) struct __user_cap_header_struct header; struct __user_cap_data_struct cap; - prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0); + if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0) { + exit(1); + } /* add extra groups: ** AID_ADB to access the USB driver @@ -907,11 +909,17 @@ int adb_main(int is_daemon, int server_port) */ gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS, AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_RW, AID_MOUNT }; - setgroups(sizeof(groups)/sizeof(groups[0]), groups); + if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { + exit(1); + } /* then switch user and group to "shell" */ - setgid(AID_SHELL); - setuid(AID_SHELL); + if (setgid(AID_SHELL) != 0) { + exit(1); + } + if (setuid(AID_SHELL) != 0) { + exit(1); + } /* set CAP_SYS_BOOT capability, so "adb reboot" will succeed */ header.version = _LINUX_CAPABILITY_VERSION; |