Commit 2708c74e authored by topjohnwu's avatar topjohnwu

Add O_CLOEXEC to opens

parent 50ff1140
...@@ -79,14 +79,14 @@ static inline int parse_ppid(const int pid) { ...@@ -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) { ...@@ -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");
......
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