From 490d0814ee6ff8fb81d92fce1698f090734ceeef Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 4 Feb 2013 21:54:33 +0100 Subject: [PATCH] Check for root permissions after parsing command line --- src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 13c76a7d..aa95214d 100644 --- a/src/main.c +++ b/src/main.c @@ -370,17 +370,17 @@ int main(int argc, char** argv) signal(SIGCHLD, handle_children); signal(SIGALRM, handle_alarm); - if (getuid() != 0) { - fprintf(stderr, "This server requires root access to operate.\n"); - exit(1); - } - /* load configuration */ ret = cmd_parser(argc, argv, &config); if (ret < 0) { fprintf(stderr, "Error in arguments\n"); exit(1); } + + if (getuid() != 0) { + fprintf(stderr, "This server requires root access to operate.\n"); + exit(1); + } s.config = &config; s.tun = &tun;