From: Mark Andrews Date: Wed, 19 Jun 2024 07:16:34 +0000 (+1000) Subject: Check that FILE_STREAM(channel) is not already closed X-Git-Tag: alessio/regression/026024a6ae~22^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48d39f7c30c8aae867abe563a3f748d715b9b41b;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/isc/log.c b/lib/isc/log.c index 472c57d956a..53785df3c63 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -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 { /*