exit when running as a nonexistent user and warn when running as root

This commit is contained in:
Rayson Zhu
2016-11-14 21:14:06 +08:00
committed by Rayson zhu
parent d1765df9f9
commit 07d2b1a005
5 changed files with 26 additions and 11 deletions
+5 -2
View File
@@ -1871,8 +1871,11 @@ main(int argc, char **argv)
ev_timer_start(EV_DEFAULT, &block_list_watcher);
// setuid
if (user != NULL) {
run_as(user);
if (user != NULL && ! run_as(user)) {
FATAL("failed to switch user");
}
if (geteuid() == 0){
LOGI("You are running this process as the root user!");
}
// init block list