From 6e0e72a0a25dc55e38ad2828a3acdba9dfc3907e Mon Sep 17 00:00:00 2001 From: venaas Date: Thu, 3 Jul 2008 11:11:58 +0000 Subject: changed to using gconfig lint type for loglevel git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@295 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'radsecproxy.c') diff --git a/radsecproxy.c b/radsecproxy.c index b6071a6..50a0478 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -3615,7 +3615,7 @@ int confrewrite_cb(struct gconffile **cf, void *arg, char *block, char *opt, cha } void getmainconfig(const char *configfile) { - char *loglevel = NULL; + long int loglevel = LONG_MIN; struct gconffile *cfs; cfs = openconfigfile(configfile); @@ -3647,7 +3647,7 @@ void getmainconfig(const char *configfile) { "ListenAccountingUDP", CONF_STR, &options.listenaccudp, "SourceUDP", CONF_STR, &options.sourceudp, "SourceTCP", CONF_STR, &options.sourcetcp, - "LogLevel", CONF_STR, &loglevel, + "LogLevel", CONF_LINT, &loglevel, "LogDestination", CONF_STR, &options.logdestination, "LoopPrevention", CONF_BLN, &options.loopprevention, "Client", CONF_CBK, confclient_cb, NULL, @@ -3659,11 +3659,10 @@ void getmainconfig(const char *configfile) { )) debugx(1, DBG_ERR, "configuration error"); - if (loglevel) { - if (strlen(loglevel) != 1 || *loglevel < '1' || *loglevel > '4') - debugx(1, DBG_ERR, "error in %s, value of option LogLevel is %s, must be 1, 2, 3 or 4", configfile, loglevel); - options.loglevel = *loglevel - '0'; - free(loglevel); + if (loglevel != LONG_MIN) { + if (loglevel < 1 || loglevel > 4) + debugx(1, DBG_ERR, "error in %s, value of option LogLevel is %d, must be 1, 2, 3 or 4", configfile, loglevel); + options.loglevel = (uint8_t)loglevel; } } -- cgit v1.1