Merge "adbd: unconditionally call setgroups"

This commit is contained in:
Nick Kralevich 2014-06-18 20:01:21 +00:00 committed by Gerrit Code Review
commit 4e6aa6a227

View file

@ -1344,11 +1344,6 @@ int adb_main(int is_daemon, int server_port)
" unchanged.\n"); " unchanged.\n");
} }
/* don't listen on a port (default 5037) if running in secure mode */
/* don't run as root if we are running in secure mode */
if (should_drop_privileges()) {
drop_capabilities_bounding_set_if_needed();
/* add extra groups: /* add extra groups:
** AID_ADB to access the USB driver ** AID_ADB to access the USB driver
** AID_LOG to read system logs (adb logcat) ** AID_LOG to read system logs (adb logcat)
@ -1367,6 +1362,11 @@ int adb_main(int is_daemon, int server_port)
exit(1); exit(1);
} }
/* don't listen on a port (default 5037) if running in secure mode */
/* don't run as root if we are running in secure mode */
if (should_drop_privileges()) {
drop_capabilities_bounding_set_if_needed();
/* then switch user and group to "shell" */ /* then switch user and group to "shell" */
if (setgid(AID_SHELL) != 0) { if (setgid(AID_SHELL) != 0) {
exit(1); exit(1);