]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
logging: don't close stderr in finalization
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 11 Jun 2025 07:03:48 +0000 (09:03 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 11 Jun 2025 07:22:32 +0000 (09:22 +0200)
When logging to stderr, don't close it in finalization in case something
else still wanted to write to it. Leave it as it is together with stdin
and stdout.

logging.c

index db2e6f604cead4a9ddf6bedccbbd1f373dab50ef..269f1cd9d9d34ac170d697128d45f2fb2b403f74 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -91,7 +91,7 @@ LOG_Finalise(void)
   if (system_log)
     closelog();
 
-  if (file_log)
+  if (file_log && file_log != stderr)
     fclose(file_log);
   file_log = NULL;
   Free(file_log_path);