1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

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
This commit is contained in:
Michael Smith 2004-07-23 02:49:33 +00:00
parent 254b210ebb
commit bef7e4e022

View File

@ -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);
}