mirror of
https://github.com/kakwa/uts-server
synced 2025-01-08 12:44:30 +01:00
fix default log_level, and fix chdir
* the chdir was done after the loading of the conf file, reversing it * in case log_level is not set, the application would segfault, now handled properly (default is info) * remove logging to the daemon facility
This commit is contained in:
parent
43984fd1b5
commit
9a05006d1e
@ -90,7 +90,7 @@ void skeleton_daemon() {
|
||||
}
|
||||
|
||||
/* Open the log file */
|
||||
openlog("uts-server", LOG_PID, LOG_DAEMON);
|
||||
//openlog("uts-server", LOG_PID, LOG_DAEMON);
|
||||
}
|
||||
|
||||
void log_hex(rfc3161_context *ct, int priority, char *id,
|
||||
@ -218,18 +218,26 @@ static CONF *load_config_file(rfc3161_context *ct, const char *filename) {
|
||||
}
|
||||
|
||||
int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
||||
int ret = 0;
|
||||
CONF *conf = load_config_file(ct, conf_file);
|
||||
ret = 1;
|
||||
chdir(conf_wd);
|
||||
int ret = 1;
|
||||
int http_counter = 0;
|
||||
|
||||
chdir(conf_wd);
|
||||
CONF *conf = load_config_file(ct, conf_file);
|
||||
if(conf == NULL)
|
||||
goto end;
|
||||
|
||||
// first pass to set the loglevel as soon as possible
|
||||
for (int i = 0; i < RFC3161_OPTIONS_LEN; i++) {
|
||||
int type = rfc3161_options[i].type;
|
||||
const char *name = rfc3161_options[i].name;
|
||||
const char *default_value = rfc3161_options[i].default_value;
|
||||
const char *value = NCONF_get_string(conf, MAIN_CONF_SECTION, name);
|
||||
if (value == NULL) {
|
||||
uts_logger(ct, LOG_NOTICE,
|
||||
"configuration param['%s'] not set, using default: '%s'",
|
||||
name, default_value);
|
||||
value = default_value;
|
||||
}
|
||||
switch (type) {
|
||||
case LOGLEVEL_OPTIONS:
|
||||
for (int j = 0;; j++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user