]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorAndreas Gustafsson <source@isc.org>
Mon, 30 Apr 2001 16:39:59 +0000 (16:39 +0000)
committerAndreas Gustafsson <source@isc.org>
Mon, 30 Apr 2001 16:39:59 +0000 (16:39 +0000)
 816.   [bug]           Report potential problems with log file accessibility
                        at configuration time, since such problems can't
                        reliably be reported at the time they actually occur.

CHANGES
bin/named/logconf.c

diff --git a/CHANGES b/CHANGES
index 6a9d369df54068a807ebedcbacaf3dc8615188e5..d20af61069add249f748c27769914086e5ad013a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,8 @@
 
+ 816.  [bug]           Report potential problems with log file accessibility
+                       at configuration time, since such problems can't
+                       reliably be reported at the time they actually occur.
+
  815.  [bug]           If a log file was specified with a path separator
                        character (i.e. "/") in its name and the directory
                        did not exist, the log file's name was treated as
index 9847fdc04476d785d643b6ead3b0ded7af12b391..0da53941d7e238ba9ef7c29614c43cb908e181ab 100644 (file)
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: logconf.c,v 1.26.4.1 2001/01/09 22:31:55 bwelling Exp $ */
+/* $Id: logconf.c,v 1.26.4.2 2001/04/30 16:39:59 gson Exp $ */
 
 #include <config.h>
 
 #include <isc/result.h>
+#include <isc/stdio.h>
 #include <isc/string.h>
 
 #include <named/log.h>
@@ -206,6 +207,31 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) {
 
        result = isc_log_createchannel(lctx, cchan->name,
                                       type, level, &dest, flags);
+
+       if (result == ISC_R_SUCCESS && type == ISC_LOG_TOFILE) {
+               FILE *fp;
+               
+               /*
+                * Test that the file can be opened, since isc_log_open()
+                * can't effectively report failures when called in
+                * isc_log_doit().
+                */
+               result = isc_stdio_open(dest.file.name, "a", &fp);
+               if (result != ISC_R_SUCCESS)
+                       isc_log_write(ns_g_lctx, DNS_LOGCATEGORY_CONFIG,
+                                     NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+                                     "logging channel '%s' file '%s': %s",
+                                     channelname, dest.file.name,
+                                     isc_result_totext(result));
+               else
+                       (void)isc_stdio_close(fp);
+
+               /*
+                * Allow named to continue by returning success.
+                */
+               result = ISC_R_SUCCESS;
+       }
+
        return (result);
 }