[xiph-commits] r7265 - icecast/trunk/icecast/src

msmith at dactyl.lonelymoon.com msmith
Thu Jul 22 19:49:35 PDT 2004


Author: msmith
Date: Thu Jul 22 19:49:35 2004
New Revision: 7265

Modified:
icecast/trunk/icecast/src/main.c
Log:
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.



Modified: icecast/trunk/icecast/src/main.c
===================================================================
--- icecast/trunk/icecast/src/main.c	2004-07-23 01:49:17 UTC (rev 7264)
+++ icecast/trunk/icecast/src/main.c	2004-07-23 02:49:33 UTC (rev 7265)
@@ -176,19 +176,24 @@
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 @@
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);
}



More information about the commits mailing list