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: Shaka Huang <shakalaca@gmail.com>
This commit is contained in:
parent
a6f81c66e5
commit
b9cdc755d1
@ -172,8 +172,6 @@ static int switch_cgroup(const char *cgroup, int pid) {
|
|||||||
// Change process name
|
// Change process name
|
||||||
set_nice_name("magiskd");
|
set_nice_name("magiskd");
|
||||||
|
|
||||||
magisk_logging();
|
|
||||||
|
|
||||||
int fd = xopen("/dev/null", O_WRONLY);
|
int fd = xopen("/dev/null", O_WRONLY);
|
||||||
xdup2(fd, STDOUT_FILENO);
|
xdup2(fd, STDOUT_FILENO);
|
||||||
xdup2(fd, STDERR_FILENO);
|
xdup2(fd, STDERR_FILENO);
|
||||||
@ -184,6 +182,8 @@ static int switch_cgroup(const char *cgroup, int pid) {
|
|||||||
if (fd > STDERR_FILENO)
|
if (fd > STDERR_FILENO)
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
magisk_logging();
|
||||||
|
|
||||||
setsid();
|
setsid();
|
||||||
setcon("u:r:" SEPOL_PROC_DOMAIN ":s0");
|
setcon("u:r:" SEPOL_PROC_DOMAIN ":s0");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user