mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-02 16:03:45 +00:00
exit when running as a nonexistent user and warn when running as root
This commit is contained in:
+5
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user