mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 08:35:31 +00:00
634. [bug] A log file will completely stop being written when
it reaches the maximum size in all cases, not just when versioning is also enabled. [RT #570]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
634. [bug] A log file will completely stop being written when
|
||||||
|
it reaches the maximum size in all cases, not just
|
||||||
|
when versioning is also enabled. [RT #570]
|
||||||
|
|
||||||
633. [port] Cope with rlim_t missing on BSD/OS systems. [RT #575]
|
633. [port] Cope with rlim_t missing on BSD/OS systems. [RT #575]
|
||||||
|
|
||||||
--- 9.1.0b2 released ---
|
--- 9.1.0b2 released ---
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: log.h,v 1.34 2000/12/12 05:29:33 tale Exp $ */
|
/* $Id: log.h,v 1.35 2000/12/23 19:23:47 tale Exp $ */
|
||||||
|
|
||||||
#ifndef ISC_LOG_H
|
#ifndef ISC_LOG_H
|
||||||
#define ISC_LOG_H 1
|
#define ISC_LOG_H 1
|
||||||
@@ -107,6 +107,7 @@ typedef struct isc_logfile {
|
|||||||
* to a size large enough for the largest possible file on a system.
|
* to a size large enough for the largest possible file on a system.
|
||||||
*/
|
*/
|
||||||
isc_offset_t maximum_size;
|
isc_offset_t maximum_size;
|
||||||
|
isc_boolean_t maximum_reached; /* Private. */
|
||||||
} isc_logfile_t;
|
} isc_logfile_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: log.c,v 1.54 2000/12/12 05:29:31 tale Exp $ */
|
/* $Id: log.c,v 1.55 2000/12/23 19:23:48 tale Exp $ */
|
||||||
|
|
||||||
/* Principal Authors: DCL */
|
/* Principal Authors: DCL */
|
||||||
|
|
||||||
@@ -233,11 +233,12 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||||||
* Convenience macros.
|
* Convenience macros.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FACILITY(channel) (channel->destination.facility)
|
#define FACILITY(channel) (channel->destination.facility)
|
||||||
#define FILE_NAME(channel) (channel->destination.file.name)
|
#define FILE_NAME(channel) (channel->destination.file.name)
|
||||||
#define FILE_STREAM(channel) (channel->destination.file.stream)
|
#define FILE_STREAM(channel) (channel->destination.file.stream)
|
||||||
#define FILE_VERSIONS(channel) (channel->destination.file.versions)
|
#define FILE_VERSIONS(channel) (channel->destination.file.versions)
|
||||||
#define FILE_MAXSIZE(channel) (channel->destination.file.maximum_size)
|
#define FILE_MAXSIZE(channel) (channel->destination.file.maximum_size)
|
||||||
|
#define FILE_MAXREACHED(channel) (channel->destination.file.maximum_reached)
|
||||||
|
|
||||||
/****
|
/****
|
||||||
**** Public interfaces.
|
**** Public interfaces.
|
||||||
@@ -724,8 +725,9 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
|||||||
FILE_NAME(channel) =
|
FILE_NAME(channel) =
|
||||||
isc_mem_strdup(mctx, destination->file.name);
|
isc_mem_strdup(mctx, destination->file.name);
|
||||||
FILE_STREAM(channel) = NULL;
|
FILE_STREAM(channel) = NULL;
|
||||||
FILE_MAXSIZE(channel) = destination->file.maximum_size;
|
|
||||||
FILE_VERSIONS(channel) = destination->file.versions;
|
FILE_VERSIONS(channel) = destination->file.versions;
|
||||||
|
FILE_MAXSIZE(channel) = destination->file.maximum_size;
|
||||||
|
FILE_MAXREACHED(channel) = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ISC_LOG_TOFILEDESC:
|
case ISC_LOG_TOFILEDESC:
|
||||||
@@ -1588,6 +1590,31 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||||||
|
|
||||||
switch (channel->type) {
|
switch (channel->type) {
|
||||||
case ISC_LOG_TOFILE:
|
case ISC_LOG_TOFILE:
|
||||||
|
if (FILE_MAXREACHED(channel)) {
|
||||||
|
/*
|
||||||
|
* If the file can be rolled, OR
|
||||||
|
* If the file no longer exists, OR
|
||||||
|
* If the file is less than the maximum size,
|
||||||
|
* (such as if it had been renamed and
|
||||||
|
* a new one touched, or it was truncated
|
||||||
|
* in place)
|
||||||
|
* ... then close it to trigger reopening.
|
||||||
|
*/
|
||||||
|
if (FILE_VERSIONS(channel) !=
|
||||||
|
ISC_LOG_ROLLNEVER ||
|
||||||
|
(stat(FILE_NAME(channel), &statbuf) != 0 &&
|
||||||
|
errno == ENOENT) ||
|
||||||
|
statbuf.st_size < FILE_MAXSIZE(channel)) {
|
||||||
|
fclose(FILE_STREAM(channel));
|
||||||
|
FILE_STREAM(channel) = NULL;
|
||||||
|
FILE_MAXREACHED(channel) = ISC_FALSE;
|
||||||
|
} else
|
||||||
|
/*
|
||||||
|
* Eh, skip it.
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (FILE_STREAM(channel) == NULL) {
|
if (FILE_STREAM(channel) == NULL) {
|
||||||
result = isc_log_open(channel);
|
result = isc_log_open(channel);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@@ -1617,8 +1644,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the file now exceeds its maximum size
|
* If the file now exceeds its maximum size
|
||||||
* threshold, close it and mark it ready
|
* threshold, note it so that it will not be logged
|
||||||
* for reopening the next time the channel is used.
|
* to any more.
|
||||||
*/
|
*/
|
||||||
if (FILE_MAXSIZE(channel) != 0) {
|
if (FILE_MAXSIZE(channel) != 0) {
|
||||||
INSIST(channel->type == ISC_LOG_TOFILE);
|
INSIST(channel->type == ISC_LOG_TOFILE);
|
||||||
@@ -1627,10 +1654,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||||||
/* XXXDCL complain if fstat fails? */
|
/* XXXDCL complain if fstat fails? */
|
||||||
if (fstat(fileno(FILE_STREAM(channel)),
|
if (fstat(fileno(FILE_STREAM(channel)),
|
||||||
&statbuf) >= 0 &&
|
&statbuf) >= 0 &&
|
||||||
statbuf.st_size > FILE_MAXSIZE(channel)) {
|
statbuf.st_size > FILE_MAXSIZE(channel))
|
||||||
fclose(FILE_STREAM(channel));
|
FILE_MAXREACHED(channel) = ISC_TRUE;
|
||||||
FILE_STREAM(channel) = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user