diff options
Diffstat (limited to 'minadbd')
-rw-r--r-- | minadbd/Android.mk | 1 | ||||
-rw-r--r-- | minadbd/adb_main.cpp | 10 | ||||
-rw-r--r-- | minadbd/services.cpp | 17 |
3 files changed, 11 insertions, 17 deletions
diff --git a/minadbd/Android.mk b/minadbd/Android.mk index a7a3e087d..3db3b4114 100644 --- a/minadbd/Android.mk +++ b/minadbd/Android.mk @@ -15,6 +15,7 @@ LOCAL_SRC_FILES := \ fuse_adb_provider.cpp \ services.cpp \ +LOCAL_CLANG := true LOCAL_MODULE := libminadbd LOCAL_CFLAGS := $(minadbd_cflags) LOCAL_CONLY_FLAGS := -Wimplicit-function-declaration diff --git a/minadbd/adb_main.cpp b/minadbd/adb_main.cpp index 7fae99a9a..0694280cb 100644 --- a/minadbd/adb_main.cpp +++ b/minadbd/adb_main.cpp @@ -19,21 +19,15 @@ #include <stdio.h> #include <stdlib.h> -#define TRACE_TAG TRACE_ADB - #include "sysdeps.h" #include "adb.h" #include "adb_auth.h" #include "transport.h" -int adb_main(int is_daemon, int server_port) -{ - atexit(usb_cleanup); - +int adb_server_main(int is_daemon, int server_port, int /* reply_fd */) { adb_device_banner = "sideload"; - // No SIGCHLD. Let the service subproc handle its children. signal(SIGPIPE, SIG_IGN); // We can't require authentication for sideloading. http://b/22025550. @@ -42,7 +36,7 @@ int adb_main(int is_daemon, int server_port) init_transport_registration(); usb_init(); - D("Event loop starting\n"); + VLOG(ADB) << "Event loop starting"; fdevent_loop(); return 0; diff --git a/minadbd/services.cpp b/minadbd/services.cpp index dd1fd7c4b..d25648fb4 100644 --- a/minadbd/services.cpp +++ b/minadbd/services.cpp @@ -23,7 +23,6 @@ #include "sysdeps.h" -#define TRACE_TAG TRACE_SERVICES #include "adb.h" #include "fdevent.h" #include "fuse_adb_provider.h" @@ -44,13 +43,14 @@ void* service_bootstrap_func(void* x) { } static void sideload_host_service(int sfd, void* data) { - const char* args = reinterpret_cast<const char*>(data); + char* args = reinterpret_cast<char*>(data); int file_size; int block_size; if (sscanf(args, "%d:%d", &file_size, &block_size) != 2) { printf("bad sideload-host arguments: %s\n", args); exit(1); } + free(args); printf("sideload-host file size %d block size %d\n", file_size, block_size); @@ -61,8 +61,7 @@ static void sideload_host_service(int sfd, void* data) { exit(result == 0 ? 0 : 1); } -static int create_service_thread(void (*func)(int, void *), void *cookie) -{ +static int create_service_thread(void (*func)(int, void *), void *cookie) { int s[2]; if(adb_socketpair(s)) { printf("cannot create service socket pair\n"); @@ -75,8 +74,7 @@ static int create_service_thread(void (*func)(int, void *), void *cookie) sti->cookie = cookie; sti->fd = s[1]; - adb_thread_t t; - if (adb_thread_create( &t, service_bootstrap_func, sti)){ + if (!adb_thread_create(service_bootstrap_func, sti)) { free(sti); adb_close(s[0]); adb_close(s[1]); @@ -84,11 +82,11 @@ static int create_service_thread(void (*func)(int, void *), void *cookie) return -1; } - D("service thread started, %d:%d\n",s[0], s[1]); + VLOG(SERVICES) << "service thread started, " << s[0] << ":" << s[1]; return s[0]; } -int service_to_fd(const char* name) { +int service_to_fd(const char* name, const atransport* transport) { int ret = -1; if (!strncmp(name, "sideload:", 9)) { @@ -97,7 +95,8 @@ int service_to_fd(const char* name) { // sideload-host). exit(3); } else if (!strncmp(name, "sideload-host:", 14)) { - ret = create_service_thread(sideload_host_service, (void*)(name + 14)); + char* arg = strdup(name + 14); + ret = create_service_thread(sideload_host_service, arg); } if (ret >= 0) { close_on_exec(ret); |