Commit da38f59e authored by topjohnwu's avatar topjohnwu

Only run destructor if necessary

parent cf4ef54d
...@@ -63,9 +63,11 @@ static void sanitize_environ() { ...@@ -63,9 +63,11 @@ static void sanitize_environ() {
__attribute__((destructor)) __attribute__((destructor))
static void zygisk_cleanup_wait() { static void zygisk_cleanup_wait() {
// Wait 10us to make sure none of our code is executing if (self_handle) {
timespec ts = { .tv_sec = 0, .tv_nsec = 10000L }; // Wait 10us to make sure none of our code is executing
nanosleep(&ts, nullptr); timespec ts = { .tv_sec = 0, .tv_nsec = 10000L };
nanosleep(&ts, nullptr);
}
} }
#define SECOND_STAGE_PTR "ZYGISK_PTR" #define SECOND_STAGE_PTR "ZYGISK_PTR"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment