diff --git a/bin/named/logconf.c b/bin/named/logconf.c index 1c789594cc..0198dea8a9 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -15,12 +15,13 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: logconf.c,v 1.28 2001/03/04 21:21:22 bwelling Exp $ */ +/* $Id: logconf.c,v 1.29 2001/04/26 02:38:08 tale Exp $ */ #include #include #include +#include #include #include @@ -209,6 +210,31 @@ channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) { result = isc_log_createchannel(lctx, channelname, 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); }