From 516c0f644596e2fa9486414946787bd169b02b14 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Mon, 26 Oct 2015 14:27:19 +0100 Subject: [PATCH] mxqd: Fix root check --- mxqd.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mxqd.c b/mxqd.c index bec2797..697eff5 100644 --- a/mxqd.c +++ b/mxqd.c @@ -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); @@ -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);