From f9ecb7e5b111193db0f5d714e748762ee2b8be1b Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 1 Jun 2021 19:34:19 +0200 Subject: C89 Compat --- src/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 3c7f0b8..09d4a3f 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,8 @@ #include #include +#include + #include "log.h" #include "server.h" @@ -27,20 +29,21 @@ void print_help( char *_argv0 ) { } void parse_args( server_config_t *_config, int argc, char* argv[]) { + int i, o; memset( _config, 0, sizeof( server_config_t ) ); _config->bind_ip = "0.0.0.0"; _config->bind_port = 53; _config->zonefile = "/nofile"; - for( int i = 1; i < argc; i++ ) { + for( i = 1; i < argc; i++ ) { const int icpy = i; if ( argv[i][0] != '-' ) { print_help( argv[0] ); exit( 1 ); } - for( int o = 1; o < strlen(argv[icpy]); o++ ) { + for( o = 1; o < strlen(argv[icpy]); o++ ) { switch( argv[icpy][o] ) { case 'h': print_help( argv[0] ); @@ -69,6 +72,10 @@ int main(int argc, char* argv[]) parse_args( &config, argc, argv ); log_init_stdout(_LOG_DEBUG); + + if ( getuid() == 0 ) + LOGPRINTF(_LOG_WARNING, "Running as root is not a good idea. Use setcap or unprivileged port instead."); + #ifdef _TEST run_test(); -- cgit v1.2.3