Make starting daemon much easier

This commit is contained in:
topjohnwu 2016-12-10 23:45:14 +08:00
parent 2d1d70b3b6
commit 42a66ad49e

View File

@ -583,6 +583,19 @@ int run_daemon() {
prepare();
switch (fork()) {
case 0:
break;
case -1:
PLOGE("fork");
return 1;
default:
return 0;
}
if (setsid() < 0 || setcon("u:r:su_daemon:s0") < 0)
return 1;
int fd;
struct sockaddr_un sun;