Skip to content

Commit

Permalink
mxqd: Fix root check
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Oct 26, 2015
1 parent 9f5688d commit 516c0f6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,15 @@ int server_init(struct mxq_server *server, int argc, char *argv[])

MX_GETOPT_FINISH(optctl, argc, argv);

if (!RUNNING_AS_ROOT) {
#if defined(MXQ_DEVELOPMENT) || defined(RUNASNORMALUSER)
mx_log_notice("Running mxqd as non-root user.");
#else
mx_log_err("Running mxqd as non-root user is not supported at the moment.");
exit(EX_USAGE);
#endif
}

if (arg_daemonize && arg_nolog) {
mx_log_err("Error while using conflicting options --daemonize and --no-log at once.");
exit(EX_USAGE);
Expand Down Expand Up @@ -501,15 +510,6 @@ int server_init(struct mxq_server *server, int argc, char *argv[])
}
}

if (!RUNNING_AS_ROOT) {
#if defined(MXQ_DEVELOPMENT) || defined(RUNASNORMALUSER)
mx_log_notice("Running mxqd as non-root user.");
#else
mx_log_err("Running mxqd as non-root user is not supported at the moment.");
exit(EX_USAGE);
#endif
}

res = mx_read_first_line_from_file("/proc/sys/kernel/random/boot_id", &str_bootid);
assert(res == 36);
assert(str_bootid);
Expand Down

0 comments on commit 516c0f6

Please sign in to comment.