Commit 8a4c5293 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Cleanup: make strcmp() more explicit in _start_logging()

This avoids if(strcmp()) constructs in favor of if(strcmp() == 0)
constructs. This is aligned with coding style and will improve
readability of the code.

Thanks to miksago. closes #2102
parent b498d4bd
......@@ -227,15 +227,15 @@ static int _start_logging(void)
ice_config_t *config = config_get_config_unlocked();
if(strcmp(config->error_log, "-")) {
if(strcmp(config->error_log, "-") == 0) {
/* this is already in place because of _start_logging_stdout() */
} else {
snprintf(fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
errorlog = log_open(fn_error);
log_to_stderr = 0;
if (config->logsize)
log_set_trigger (errorlog, config->logsize);
log_set_archive_timestamp(errorlog, config->logarchive);
} else {
/* this is already in place because of _start_logging_stdout() */
}
if (errorlog < 0) {
......@@ -248,16 +248,16 @@ static int _start_logging(void)
}
log_set_level(errorlog, config->loglevel);
if(strcmp(config->access_log, "-")) {
if(strcmp(config->access_log, "-") == 0) {
accesslog = log_open_file(stderr);
log_to_stderr = 1;
} else {
snprintf(fn_access, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
accesslog = log_open(fn_access);
log_to_stderr = 0;
if (config->logsize)
log_set_trigger (accesslog, config->logsize);
log_set_archive_timestamp(accesslog, config->logarchive);
} else {
accesslog = log_open_file(stderr);
log_to_stderr = 1;
}
if (accesslog < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment