SIGPIPE is handled in main daemon
This commit is contained in:
parent
2c4001387e
commit
513d732934
14
su_daemon.c
14
su_daemon.c
@ -358,24 +358,10 @@ void su_daemon_receiver(int client, struct ucred *credential) {
|
|||||||
else
|
else
|
||||||
code = -1;
|
code = -1;
|
||||||
|
|
||||||
/* Passing the return code back to the client:
|
|
||||||
* The client might be closed unexpectedly (e.g. swipe a root app out of recents)
|
|
||||||
* In that case, writing to the client (which doesn't exist) will result in SIGPIPE
|
|
||||||
* Here we simply just ignore the situation.
|
|
||||||
*/
|
|
||||||
struct sigaction act;
|
|
||||||
memset(&act, 0, sizeof(act));
|
|
||||||
act.sa_handler = SIG_IGN;
|
|
||||||
sigaction(SIGPIPE, &act, NULL);
|
|
||||||
|
|
||||||
LOGD("su: return code: [%d]\n", code);
|
LOGD("su: return code: [%d]\n", code);
|
||||||
write(client, &code, sizeof(code));
|
write(client, &code, sizeof(code));
|
||||||
close(client);
|
close(client);
|
||||||
|
|
||||||
// Restore default handler for SIGPIPE
|
|
||||||
act.sa_handler = SIG_DFL;
|
|
||||||
sigaction(SIGPIPE, &act, NULL);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user