mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-01 05:55:26 +00:00
Close client fd using thread local storage
This commit is contained in:
parent
3904ca38c0
commit
371db886b4
@ -26,6 +26,7 @@
|
|||||||
#define ATTY_ERR 4
|
#define ATTY_ERR 4
|
||||||
|
|
||||||
struct ucred su_credentials;
|
struct ucred su_credentials;
|
||||||
|
static __thread int client_fd;
|
||||||
|
|
||||||
static void sighandler(int sig) {
|
static void sighandler(int sig) {
|
||||||
restore_stdin();
|
restore_stdin();
|
||||||
@ -52,6 +53,8 @@ static void sighandler(int sig) {
|
|||||||
|
|
||||||
static void sigpipe_handler(int sig) {
|
static void sigpipe_handler(int sig) {
|
||||||
LOGD("su: Client killed unexpectedly\n");
|
LOGD("su: Client killed unexpectedly\n");
|
||||||
|
close(client_fd);
|
||||||
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void su_daemon_receiver(int client) {
|
void su_daemon_receiver(int client) {
|
||||||
@ -69,6 +72,9 @@ void su_daemon_receiver(int client) {
|
|||||||
return;
|
return;
|
||||||
} else if (child != 0) {
|
} else if (child != 0) {
|
||||||
|
|
||||||
|
// For sighandler to close it
|
||||||
|
client_fd = client;
|
||||||
|
|
||||||
// Wait result
|
// Wait result
|
||||||
LOGD("su: wait_result waiting for %d\n", child);
|
LOGD("su: wait_result waiting for %d\n", child);
|
||||||
int status, code;
|
int status, code;
|
||||||
|
Loading…
Reference in New Issue
Block a user