From 4bf2526f886d71a067a1004ee5be2b75d0f721f7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 12 Dec 2024 17:10:49 +0100 Subject: Merging upstream version 3.9.1. Signed-off-by: Daniel Baumann --- src/global/mail_version.h | 4 ++-- src/global/maillog_client.c | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src/global') diff --git a/src/global/mail_version.h b/src/global/mail_version.h index 9e08896..bbd5d21 100644 --- a/src/global/mail_version.h +++ b/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20240306" -#define MAIL_VERSION_NUMBER "3.9" +#define MAIL_RELEASE_DATE "20241204" +#define MAIL_VERSION_NUMBER "3.9.1" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/src/global/maillog_client.c b/src/global/maillog_client.c index 34952ef..a6e8436 100644 --- a/src/global/maillog_client.c +++ b/src/global/maillog_client.c @@ -120,6 +120,7 @@ static int maillog_client_flags; static void maillog_client_logwriter_fallback(const char *text) { static int fallback_guard = 0; + static VSTREAM *fp; /* * Guard against recursive calls. @@ -129,10 +130,20 @@ static void maillog_client_logwriter_fallback(const char *text) * logfile. All we can do is to hope that stderr logging will bring out * the bad news. */ - if (fallback_guard == 0 && var_maillog_file && *var_maillog_file - && logwriter_one_shot(var_maillog_file, text, strlen(text)) < 0) { - fallback_guard = 1; - msg_fatal("logfile '%s' write error: %m", var_maillog_file); + if (fallback_guard++ == 0 && var_maillog_file && *var_maillog_file) { + if (text == 0 && fp != 0) { + (void) vstream_fclose(fp); + fp = 0; + } + if (fp == 0) { + fp = logwriter_open_or_die(var_maillog_file); + close_on_exec(vstream_fileno(fp), CLOSE_ON_EXEC); + } + if (text && (logwriter_write(fp, text, strlen(text)) != 0 || + vstream_fflush(fp) != 0)) { + msg_fatal("logfile '%s' write error: %m", var_maillog_file); + } + fallback_guard = 0; } } -- cgit v1.2.3