[xiph-cvs] r6495 - icecast/trunk/icecast/src

msmith at xiph.org msmith at xiph.org
Tue Apr 6 18:53:46 PDT 2004



Author: msmith
Date: 2004-04-06 21:53:46 -0400 (Tue, 06 Apr 2004)
New Revision: 6495

Modified:
   icecast/trunk/icecast/src/main.c
Log:
Give details in error messages on failure to open log files. 

<p>Modified: icecast/trunk/icecast/src/main.c
===================================================================
--- icecast/trunk/icecast/src/main.c	2004-04-06 21:18:53 UTC (rev 6494)
+++ icecast/trunk/icecast/src/main.c	2004-04-07 01:53:46 UTC (rev 6495)
@@ -183,7 +183,7 @@
 {
     char fn_error[FILENAME_MAX];
     char fn_access[FILENAME_MAX];
-    char pbuf[1024];
+    char buf[1024];
 
     ice_config_t *config = config_get_config_unlocked();
 
@@ -193,24 +193,32 @@
     } else {
         errorlog = log_open_file(stderr);
     }
+
+    if (errorlog < 0) {
+        buf[sizeof(buf)-1] = 0;
+        snprintf(buf, sizeof(buf)-1, "FATAL: could not open error logging: %s",
+                strerror(errno));
+        _fatal_error(buf);
+    }
+    log_set_level(errorlog, config->loglevel);
+
     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);
     } else {
         accesslog = log_open_file(stderr);
     }
+
+    if (accesslog < 0) {
+        buf[sizeof(buf)-1] = 0;
+        snprintf(buf, sizeof(buf)-1, "FATAL: could not open access logging: %s",
+                strerror(errno));
+        _fatal_error(buf);
+    }
     
     log_set_level(errorlog, config->loglevel);
     log_set_level(accesslog, 4);
 
-    if (errorlog < 0) {
-        _fatal_error("FATAL: could not open error logging");
-    }
-    if (accesslog < 0) {
-        memset(pbuf, '\000', sizeof(pbuf));
-        snprintf(pbuf, sizeof(pbuf)-1, "FATAL: could not open access logging");
-        _fatal_error(pbuf);
-    }
     if (errorlog >= 0 && accesslog >= 0) return 1;
     
     return 0;

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list