Commit bef7e4e0 authored by Michael Smith's avatar Michael Smith

Make it even more explicit what went wrong when log opening failed, since many

people don't seem to be able to figure it out.


svn path=/icecast/trunk/icecast/; revision=7265
parent 254b210e
......@@ -176,19 +176,24 @@ static int _start_logging(void)
char fn_error[FILENAME_MAX];
char fn_access[FILENAME_MAX];
char buf[1024];
int log_to_stderr;
ice_config_t *config = config_get_config_unlocked();
if(strcmp(config->error_log, "-")) {
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;
} else {
errorlog = log_open_file(stderr);
log_to_stderr = 1;
}
if (errorlog < 0) {
buf[sizeof(buf)-1] = 0;
snprintf(buf, sizeof(buf)-1, "FATAL: could not open error logging: %s",
snprintf(buf, sizeof(buf)-1,
"FATAL: could not open error logging (%s): %s",
log_to_stderr?"standard error":fn_error,
strerror(errno));
_fatal_error(buf);
}
......@@ -197,13 +202,17 @@ static int _start_logging(void)
if(strcmp(config->access_log, "-")) {
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;
} else {
accesslog = log_open_file(stderr);
log_to_stderr = 1;
}
if (accesslog < 0) {
buf[sizeof(buf)-1] = 0;
snprintf(buf, sizeof(buf)-1, "FATAL: could not open access logging: %s",
snprintf(buf, sizeof(buf)-1,
"FATAL: could not open access logging (%s): %s",
log_to_stderr?"standard error":fn_access,
strerror(errno));
_fatal_error(buf);
}
......
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