Check path when start daemon

This commit is contained in:
vvb2060
2022-05-29 14:28:56 +08:00
committed by topjohnwu
parent c0981174a8
commit d19fcd5e21
2 changed files with 8 additions and 7 deletions
+8
View File
@@ -416,6 +416,14 @@ int connect_daemon(int req, bool create) {
return -1;
}
char buf[64];
xreadlink("/proc/self/exe", buf, sizeof(buf));
if (str_starts(buf, "/system/bin/")) {
LOGE("Start daemon on /dev or /sbin\n");
close(fd);
return -1;
}
if (fork_dont_care() == 0) {
close(fd);
daemon_entry();