mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Add O_CLOEXEC to opens
This commit is contained in:
parent
50ff11405f
commit
2708c74ebe
@ -79,14 +79,14 @@ static inline int parse_ppid(const int pid) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool is_pid_safetynet_process(const int pid) {
|
static bool is_snet(const int pid) {
|
||||||
char path[32];
|
char path[32];
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
sprintf(path, "/proc/%d/cmdline", pid);
|
sprintf(path, "/proc/%d/cmdline", pid);
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ static bool process_pid(int pid) {
|
|||||||
|
|
||||||
if (uid == gms_uid) {
|
if (uid == gms_uid) {
|
||||||
// Check /proc/uid/cmdline to see if it's SAFETYNET_PROCESS
|
// Check /proc/uid/cmdline to see if it's SAFETYNET_PROCESS
|
||||||
if (!is_pid_safetynet_process(pid))
|
if (!is_snet(pid))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LOGD("proc_monitor: " SAFETYNET_PROCESS "\n");
|
LOGD("proc_monitor: " SAFETYNET_PROCESS "\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user