Commit b9cdc755 authored by Shaka Huang's avatar Shaka Huang Committed by John Wu

Returned fds[0] in socketpair() might be STDOUT

* There will be garbage output when executing `su` (#4016)
* Failed to check root status and showing N/A in status (#4005)
Signed-off-by: 's avatarShaka Huang <shakalaca@gmail.com>
parent a6f81c66
......@@ -172,8 +172,6 @@ static int switch_cgroup(const char *cgroup, int pid) {
// Change process name
set_nice_name("magiskd");
magisk_logging();
int fd = xopen("/dev/null", O_WRONLY);
xdup2(fd, STDOUT_FILENO);
xdup2(fd, STDERR_FILENO);
......@@ -184,6 +182,8 @@ static int switch_cgroup(const char *cgroup, int pid) {
if (fd > STDERR_FILENO)
close(fd);
magisk_logging();
setsid();
setcon("u:r:" SEPOL_PROC_DOMAIN ":s0");
......
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