diff --git a/0001-Fix-leaking-of-FDs-created-by-pipe.patch b/0001-Fix-leaking-of-FDs-created-by-pipe.patch new file mode 100644 index 0000000..56542ae --- /dev/null +++ b/0001-Fix-leaking-of-FDs-created-by-pipe.patch @@ -0,0 +1,34 @@ +From 34d7203c5b5c45d2140d01cd7131e51c3f9ef570 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Tue, 8 May 2018 14:11:47 +0200 +Subject: [PATCH] Fix leaking of FDs created by pipe + +Use pipe2 to pass O_CLOEXEC. +--- + libqalculate/util.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libqalculate/util.cc b/libqalculate/util.cc +index a1d29b7..8ee8bcf 100644 +--- a/libqalculate/util.cc ++++ b/libqalculate/util.cc +@@ -38,6 +38,7 @@ + # include + # include + #else ++# include + # include + # include + # include +@@ -834,7 +835,7 @@ bool Thread::cancel() { + Thread::Thread() : running(false), m_pipe_r(NULL), m_pipe_w(NULL) { + pthread_attr_init(&m_thread_attr); + int pipe_wr[] = {0, 0}; +- if(pipe(pipe_wr) == 0) { ++ if(pipe2(pipe_wr, O_CLOEXEC) == 0) { + m_pipe_r = fdopen(pipe_wr[0], "r"); + m_pipe_w = fdopen(pipe_wr[1], "w"); + } +-- +2.16.2 + diff --git a/qalculate.changes b/qalculate.changes index 6208621..0ac59fa 100644 --- a/qalculate.changes +++ b/qalculate.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 8 12:26:36 UTC 2018 - fabian@ritter-vogt.de + +- Add patch to fix FD leak (boo#1092329): + * 0001-Fix-leaking-of-FDs-created-by-pipe.patch + ------------------------------------------------------------------- Sat Mar 10 16:53:35 UTC 2018 - fabian@ritter-vogt.de diff --git a/qalculate.spec b/qalculate.spec index ce491ef..7d945cc 100644 --- a/qalculate.spec +++ b/qalculate.spec @@ -26,6 +26,8 @@ License: GPL-2.0+ Group: Productivity/Scientific/Math Url: https://qalculate.github.io/ Source: https://github.com/Qalculate/libqalculate/releases/download/v%{version}/%{libname}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM (https://github.com/Qalculate/libqalculate/pull/87) +Patch1: 0001-Fix-leaking-of-FDs-created-by-pipe.patch BuildRequires: gcc-c++ BuildRequires: gmp-devel BuildRequires: intltool @@ -72,6 +74,7 @@ you will need to install %{libname}-devel. %prep %setup -q -n %{libname}-%{version} +%autopatch -p1 %build %configure --disable-static