adb: fix exit of "adb root" when it is a no-op.

"adb root" creates a socket, then starts the service.
Socket creation should not set the exit_on_close when the service will be
a no-op.

Bug: 6259353
Change-Id: Ie526d2fad64f39a48051ed0ff6fb3405c2802ced
This commit is contained in:
JP Abgrall 2012-03-30 11:19:16 -07:00
parent b012679f97
commit d7f1feb5c8
1 changed files with 3 additions and 2 deletions

View File

@ -426,8 +426,9 @@ asocket *create_local_service_socket(const char *name)
s = create_local_socket(fd);
D("LS(%d): bound to '%s' via %d\n", s->id, name, fd);
if (!strcmp(name, "root:") || !strcmp(name, "usb:") ||
!strcmp(name, "tcpip:")) {
if ((!strcmp(name, "root:") && getuid() != 0)
|| !strcmp(name, "usb:")
|| !strcmp(name, "tcpip:")) {
D("LS(%d): enabling exit_on_close\n", s->id);
s->exit_on_close = 1;
}