summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2018-02-23 14:00:24 -0800
committerJosh Gao <jmgao@google.com>2018-02-27 14:50:07 -0800
commitd51c6df1ef98f2b57916ddefc80afda5f1eecb59 (patch)
tree5b13e8583f4832131f24352e1c6d486834b7fb13
parent73664df55e658c8466d10272716ed855592618ce (diff)
downloadsystem_core-d51c6df1ef98f2b57916ddefc80afda5f1eecb59.tar.gz
system_core-d51c6df1ef98f2b57916ddefc80afda5f1eecb59.tar.bz2
system_core-d51c6df1ef98f2b57916ddefc80afda5f1eecb59.zip
adb: stop using quick_exit.
We don't actually need to use quick_exit to avoid calling static destructors, since we have -Wexit-time-destructors to guarantee we don't actually have any, and this precludes the use of asan's exit time leak checking, so switch back to atexit/exit. Test: ASAN_OPTIONS=detect_leaks=1:leak_check_at_exit=1 adb server nodaemon with a manually inserted leak Change-Id: Id8178913f64cb02c820c5073351369a9e4d8c74d
-rw-r--r--adb/adb.cpp3
-rw-r--r--adb/client/main.cpp7
-rw-r--r--adb/client/usb_libusb.cpp2
-rw-r--r--adb/transport.cpp1
4 files changed, 5 insertions, 8 deletions
diff --git a/adb/adb.cpp b/adb/adb.cpp
index ae8020e81..c4df5c4b9 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -42,7 +42,6 @@
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <android-base/parsenetaddress.h>
-#include <android-base/quick_exit.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
@@ -1059,7 +1058,7 @@ int handle_host_request(const char* service, TransportType type, const char* ser
SendOkay(reply_fd);
// Rely on process exit to close the socket for us.
- android::base::quick_exit(0);
+ exit(0);
}
// "transport:" is used for switching transport with a specified serial number
diff --git a/adb/client/main.cpp b/adb/client/main.cpp
index f0d0ce799..f28302b61 100644
--- a/adb/client/main.cpp
+++ b/adb/client/main.cpp
@@ -28,7 +28,6 @@
#include <android-base/errors.h>
#include <android-base/file.h>
#include <android-base/logging.h>
-#include <android-base/quick_exit.h>
#include <android-base/stringprintf.h>
#include "adb.h"
@@ -61,7 +60,7 @@ static void setup_daemon_logging() {
static BOOL WINAPI ctrlc_handler(DWORD type) {
// TODO: Consider trying to kill a starting up adb server (if we're in
// launch_server) by calling GenerateConsoleCtrlEvent().
- android::base::quick_exit(STATUS_CONTROL_C_EXIT);
+ exit(STATUS_CONTROL_C_EXIT);
return TRUE;
}
#endif
@@ -95,7 +94,7 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply
SetConsoleCtrlHandler(ctrlc_handler, TRUE);
#else
signal(SIGINT, [](int) {
- fdevent_run_on_main_thread([]() { android::base::quick_exit(0); });
+ fdevent_run_on_main_thread([]() { exit(0); });
});
#endif
@@ -104,7 +103,7 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply
setup_daemon_logging();
}
- android::base::at_quick_exit(adb_server_cleanup);
+ atexit(adb_server_cleanup);
init_transport_registration();
init_mdns_transport_discovery();
diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
index 18f585d88..46c3f58ec 100644
--- a/adb/client/usb_libusb.cpp
+++ b/adb/client/usb_libusb.cpp
@@ -19,6 +19,7 @@
#include "sysdeps.h"
#include <stdint.h>
+#include <stdlib.h>
#include <atomic>
#include <chrono>
@@ -33,7 +34,6 @@
#include <android-base/file.h>
#include <android-base/logging.h>
-#include <android-base/quick_exit.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
diff --git a/adb/transport.cpp b/adb/transport.cpp
index 14888ab70..6b1a00bf1 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -34,7 +34,6 @@
#include <android-base/logging.h>
#include <android-base/parsenetaddress.h>
-#include <android-base/quick_exit.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/thread_annotations.h>