[packages/msmtp] Rel 2. Fix double fclose() when writing the log file fails.

arekm arekm at pld-linux.org
Thu Oct 29 08:48:27 CET 2026


commit fcc1a0c85b802e1d63901bc3456c888c73c84784
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Oct 29 02:56:58 2026 +0100

    Rel 2. Fix double fclose() when writing the log file fails.

 msmtp-log-double-fclose.patch | 14 ++++++++++++++
 msmtp.spec                    | 12 ++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/msmtp.spec b/msmtp.spec
index dc47091..995fc96 100644
--- a/msmtp.spec
+++ b/msmtp.spec
@@ -1,11 +1,12 @@
 # Conditional build:
 %bcond_without	libsecret	# without libsecret
+%bcond_without	tests		# unit tests
 
 Summary:	SMTP "plugin" for MUAs
 Summary(pl.UTF-8):	"Wtyczka" SMTP dla klientów pocztowych (MUA)
 Name:		msmtp
 Version:	1.8.34
-Release:	1
+Release:	2
 License:	GPL v3+
 Group:		Networking/Utilities
 #Source0Download: https://marlam.de/msmtp/download/
@@ -13,15 +14,17 @@ Source0:	https://marlam.de/msmtp/releases/%{name}-%{version}.tar.xz
 # Source0-md5:	ef99756bc8f278208666699ca0dab14b
 Patch0:		%{name}-home_etc.patch
 Patch1:		%{name}-info.patch
+Patch2:		%{name}-log-double-fclose.patch
 Source1:	%{name}rc
 URL:		https://marlam.de/msmtp/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake >= 1:1.11.1
 BuildRequires:	gettext-tools >= 0.21
-# with AI_IDN support (or libidn2-devel)
+# getaddrinfo() with AI_IDN support
 BuildRequires:	glibc-devel >= 6:2.4
 BuildRequires:	gnutls-devel >= 3.7.2
 BuildRequires:	gsasl-devel >= 2.1
+BuildRequires:	libidn2-devel
 %{?with_libsecret:BuildRequires:	libsecret-devel}
 BuildRequires:	pkgconfig
 BuildRequires:	tar >= 1:1.22
@@ -82,6 +85,7 @@ Dowiązania symboliczne msmtp do sendmaila.
 %setup -q
 %patch -P0 -p1
 %patch -P1 -p1
+%patch -P2 -p1
 
 %build
 %{__gettextize}
@@ -97,6 +101,10 @@ Dowiązania symboliczne msmtp do sendmaila.
 	--with-tls=gnutls
 %{__make}
 
+%if %{with tests}
+%{__make} check
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sbindir},/usr/lib,%{_sysconfdir}}
diff --git a/msmtp-log-double-fclose.patch b/msmtp-log-double-fclose.patch
new file mode 100644
index 0000000..41c739d
--- /dev/null
+++ b/msmtp-log-double-fclose.patch
@@ -0,0 +1,14 @@
+# fclose() failure (e.g. logfile on a full disk) jumps to log_failure, which
+# fclose()s the same FILE again; upstream 7ca272615b25f32589dbd8a3ec0ae44f5eb730df
+diff --git a/src/msmtp.c b/src/msmtp.c
+index f9dd5b7..086e19f 100644
+--- a/src/msmtp.c
++++ b/src/msmtp.c
+@@ -2058,6 +2058,7 @@ void msmtp_log_to_file(const char *logfile, const char *logfile_time_format,
+     }
+     if (f != stdout && fclose(f) != 0)
+     {
++        f = NULL; /* prevent another fclose() attempt */
+         failure_reason = xstrdup(strerror(errno));
+         goto log_failure;
+     }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/msmtp.git/commitdiff/fcc1a0c85b802e1d63901bc3456c888c73c84784



More information about the pld-cvs-commit mailing list