mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 18:47:38 +00:00
Close fd
This commit is contained in:
parent
a0fe78a728
commit
ecd332c573
@ -361,7 +361,7 @@ static void daemon_entry() {
|
||||
}
|
||||
}
|
||||
|
||||
sockaddr_un sun;
|
||||
sockaddr_un sun{};
|
||||
socklen_t len = setup_sockaddr(&sun, MAIN_SOCKET);
|
||||
fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (xbind(fd, (sockaddr*) &sun, len))
|
||||
@ -380,12 +380,13 @@ static void daemon_entry() {
|
||||
}
|
||||
|
||||
int connect_daemon(bool create) {
|
||||
sockaddr_un sun;
|
||||
sockaddr_un sun{};
|
||||
socklen_t len = setup_sockaddr(&sun, MAIN_SOCKET);
|
||||
int fd = xsocket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (connect(fd, (sockaddr*) &sun, len)) {
|
||||
if (!create || getuid() != UID_ROOT) {
|
||||
LOGE("No daemon is currently running!\n");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user