summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--radsecproxy.c13
1 files changed, 6 insertions, 7 deletions
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;
}
}