2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Check that FILE_STREAM(channel) is not already closed

isc_log_closefilelogs can also close log files.  isc_log_doit failed
to check if the file handle was still valid before closing it.
This commit is contained in:
Mark Andrews
2024-06-19 17:16:34 +10:00
parent 6427d625ea
commit 48d39f7c30

View File

@@ -1762,8 +1762,11 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
errno == ENOENT) ||
statbuf.st_size < FILE_MAXSIZE(channel))
{
(void)fclose(FILE_STREAM(channel));
FILE_STREAM(channel) = NULL;
if (FILE_STREAM(channel) != NULL) {
(void)fclose(
FILE_STREAM(channel));
FILE_STREAM(channel) = NULL;
}
FILE_MAXREACHED(channel) = false;
} else {
/*