X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fodhcpd.c;h=8a18fbf4d23446236e7bbf3440486a3f79917c02;hp=ed96178ba48de3140833d49524a7463343536987;hb=a898ee5458950203d4b2f8fec28c85313c855b91;hpb=fa57225cb62b43adffc37a50c3dbd3fa7d225b0b diff --git a/src/odhcpd.c b/src/odhcpd.c index ed96178..8a18fbf 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,6 @@ static int ioctl_sock; static struct nl_sock *rtnl_socket = NULL; static int urandom_fd = -1; - static void sighandler(_unused int signal) { uloop_end(); @@ -65,7 +65,7 @@ static void print_usage(const char *app) "== %s Usage ==\n\n" " -h, --help Print this help\n" " -l level Specify log level 0..7 (default %d)\n", - app, LOG_WARNING + app, config.log_level ); } @@ -73,19 +73,19 @@ int main(int argc, char **argv) { openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON); int opt; - int log_level = LOG_INFO; + while ((opt = getopt(argc, argv, "hl:")) != -1) { switch (opt) { case 'h': print_usage(argv[0]); return 0; case 'l': - log_level = atoi(optarg); - fprintf(stderr, "Log level set to %d\n", log_level); + config.log_level = (atoi(optarg) & LOG_PRIMASK); + fprintf(stderr, "Log level set to %d\n", config.log_level); break; } } - setlogmask(LOG_UPTO(log_level)); + setlogmask(LOG_UPTO(config.log_level)); uloop_init(); if (getuid() != 0) {