diff options
Diffstat (limited to 'bin/named/logconf.c')
-rw-r--r-- | bin/named/logconf.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/bin/named/logconf.c b/bin/named/logconf.c index 042380b8..e349a1a0 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -17,9 +17,8 @@ #include <config.h> -#include <isc/result.h> +#include <isc/string.h> -#include <named/globals.h> #include <named/log.h> #include <named/logconf.h> @@ -28,14 +27,12 @@ if (result != ISC_R_SUCCESS) goto cleanup; \ } while (0) - /* * Set up a logging category according to the named.conf data * in 'ccat' and add it to 'lctx'. */ static isc_result_t -category_fromconf(dns_c_logcat_t *ccat, isc_logconfig_t *lctx) -{ +category_fromconf(dns_c_logcat_t *ccat, isc_logconfig_t *lctx) { isc_result_t result; unsigned int i; isc_logcategory_t *category; @@ -69,8 +66,7 @@ category_fromconf(dns_c_logcat_t *ccat, isc_logconfig_t *lctx) * in 'cchan' and add it to 'lctx'. */ static isc_result_t -channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) -{ +channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) { isc_result_t result; isc_logdestination_t dest; unsigned int type; @@ -83,9 +79,13 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) type = ISC_LOG_TOFILE; { const char *path = NULL; - isc_uint32_t versions = ISC_LOG_ROLLNEVER; + isc_int32_t versions = ISC_LOG_ROLLNEVER; + /* + * XXXDCL should be isc_offset_t, but that + * is incompatible with dns_c_logchan_getsize. + */ isc_uint32_t size = 0; - (void) dns_c_logchan_getpath(cchan, &path); + (void)dns_c_logchan_getpath(cchan, &path); if (path == NULL) { isc_log_write(ns_g_lctx, DNS_LOGCATEGORY_CONFIG, @@ -95,11 +95,13 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) "no file name"); return (ISC_R_UNEXPECTED); } - (void) dns_c_logchan_getversions(cchan, &versions); - (void) dns_c_logchan_getsize(cchan, &size); + (void)dns_c_logchan_getversions(cchan, + (isc_uint32_t *) + &versions); + (void)dns_c_logchan_getsize(cchan, &size); dest.file.stream = NULL; dest.file.name = cchan->u.filec.path; - dest.file.versions = (int)versions; + dest.file.versions = versions; dest.file.maximum_size = size; } break; @@ -108,7 +110,7 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) type = ISC_LOG_TOSYSLOG; { int facility = LOG_DAEMON; - (void) dns_c_logchan_getfacility(cchan, &facility); + (void)dns_c_logchan_getfacility(cchan, &facility); dest.facility = facility; } break; @@ -125,9 +127,9 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) isc_boolean_t printsev = ISC_FALSE; isc_boolean_t printtime = ISC_FALSE; - (void) dns_c_logchan_getprintcat(cchan, &printcat); - (void) dns_c_logchan_getprintsev(cchan, &printsev); - (void) dns_c_logchan_getprinttime(cchan, &printtime); + (void)dns_c_logchan_getprintcat(cchan, &printcat); + (void)dns_c_logchan_getprintsev(cchan, &printsev); + (void)dns_c_logchan_getprinttime(cchan, &printtime); if (printcat) flags |= ISC_LOG_PRINTCATEGORY; @@ -139,7 +141,7 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) } level = ISC_LOG_INFO; - (void) dns_c_logchan_getdebuglevel(cchan, &level); + (void)dns_c_logchan_getdebuglevel(cchan, &level); result = isc_log_createchannel(lctx, cchan->name, type, level, &dest, flags); @@ -147,13 +149,14 @@ channel_fromconf(dns_c_logchan_t *cchan, isc_logconfig_t *lctx) } isc_result_t -ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) -{ +ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) { isc_result_t result; dns_c_logchan_t *cchan; dns_c_logcat_t *ccat; isc_boolean_t default_set = ISC_FALSE; + CHECK(ns_log_setdefaultchannels(lcctx)); + for (cchan = ISC_LIST_HEAD(clog->channels); cchan != NULL; cchan = ISC_LIST_NEXT(cchan, next)) { @@ -170,7 +173,7 @@ ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) } if (! default_set) - CHECK(ns_log_setdefaults(lcctx)); + CHECK(ns_log_setdefaultcategory(lcctx)); return (ISC_R_SUCCESS); @@ -179,5 +182,3 @@ ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) isc_logconfig_destroy(&lcctx); return (result); } - - |