Loading adb/adb.h +5 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,11 @@ struct asocket { */ int closing; /* flag: quit adbd when both ends close the ** local service socket */ int exit_on_close; /* the asocket we are connected to */ Loading adb/services.c +0 −13 Original line number Diff line number Diff line Loading @@ -129,10 +129,6 @@ void restart_root_service(int fd, void *cookie) snprintf(buf, sizeof(buf), "restarting adbd as root\n"); writex(fd, buf, strlen(buf)); adb_close(fd); // quit, and init will restart us as root sleep(1); exit(1); } } Loading @@ -154,10 +150,6 @@ void restart_tcp_service(int fd, void *cookie) snprintf(buf, sizeof(buf), "restarting in TCP mode port: %d\n", port); writex(fd, buf, strlen(buf)); adb_close(fd); // quit, and init will restart us in TCP mode sleep(1); exit(1); } void restart_usb_service(int fd, void *cookie) Loading @@ -168,10 +160,6 @@ void restart_usb_service(int fd, void *cookie) snprintf(buf, sizeof(buf), "restarting in USB mode\n"); writex(fd, buf, strlen(buf)); adb_close(fd); // quit, and init will restart us in USB mode sleep(1); exit(1); } void reboot_service(int fd, void *arg) Loading Loading @@ -371,7 +359,6 @@ static void subproc_waiter_service(int fd, void *cookie) break; } } usleep(100000); // poll every 0.1 sec } D("shell exited fd=%d of pid=%d err=%d\n", fd, pid, errno); if (SHELL_EXIT_NOTIFY_FD >=0) { Loading adb/sockets.c +14 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,8 @@ static void local_socket_close(asocket *s) static void local_socket_destroy(asocket *s) { apacket *p, *n; int exit_on_close = s->exit_on_close; D("LS(%d): destroying fde.fd=%d\n", s->id, s->fde.fd); /* IMPORTANT: the remove closes the fd Loading @@ -214,6 +216,11 @@ static void local_socket_destroy(asocket *s) } remove_socket(s); free(s); if (exit_on_close) { D("local_socket_destroy: exiting\n"); exit(1); } } Loading Loading @@ -418,6 +425,13 @@ 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:")) { D("LS(%d): enabling exit_on_close\n", s->id); s->exit_on_close = 1; } return s; } Loading Loading
adb/adb.h +5 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,11 @@ struct asocket { */ int closing; /* flag: quit adbd when both ends close the ** local service socket */ int exit_on_close; /* the asocket we are connected to */ Loading
adb/services.c +0 −13 Original line number Diff line number Diff line Loading @@ -129,10 +129,6 @@ void restart_root_service(int fd, void *cookie) snprintf(buf, sizeof(buf), "restarting adbd as root\n"); writex(fd, buf, strlen(buf)); adb_close(fd); // quit, and init will restart us as root sleep(1); exit(1); } } Loading @@ -154,10 +150,6 @@ void restart_tcp_service(int fd, void *cookie) snprintf(buf, sizeof(buf), "restarting in TCP mode port: %d\n", port); writex(fd, buf, strlen(buf)); adb_close(fd); // quit, and init will restart us in TCP mode sleep(1); exit(1); } void restart_usb_service(int fd, void *cookie) Loading @@ -168,10 +160,6 @@ void restart_usb_service(int fd, void *cookie) snprintf(buf, sizeof(buf), "restarting in USB mode\n"); writex(fd, buf, strlen(buf)); adb_close(fd); // quit, and init will restart us in USB mode sleep(1); exit(1); } void reboot_service(int fd, void *arg) Loading Loading @@ -371,7 +359,6 @@ static void subproc_waiter_service(int fd, void *cookie) break; } } usleep(100000); // poll every 0.1 sec } D("shell exited fd=%d of pid=%d err=%d\n", fd, pid, errno); if (SHELL_EXIT_NOTIFY_FD >=0) { Loading
adb/sockets.c +14 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,8 @@ static void local_socket_close(asocket *s) static void local_socket_destroy(asocket *s) { apacket *p, *n; int exit_on_close = s->exit_on_close; D("LS(%d): destroying fde.fd=%d\n", s->id, s->fde.fd); /* IMPORTANT: the remove closes the fd Loading @@ -214,6 +216,11 @@ static void local_socket_destroy(asocket *s) } remove_socket(s); free(s); if (exit_on_close) { D("local_socket_destroy: exiting\n"); exit(1); } } Loading Loading @@ -418,6 +425,13 @@ 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:")) { D("LS(%d): enabling exit_on_close\n", s->id); s->exit_on_close = 1; } return s; } Loading