[packages/Carla] Patch added for proper mmap() error handling

jajcus jajcus at pld-linux.org
Thu Mar 1 11:19:47 CET 2018


commit a9613353be4f7e890d9bf5ea0030690212bdbe42
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Thu Mar 1 11:18:57 2018 +0100

    Patch added for proper mmap() error handling
    
    Fixes mysterious crashes when 'ulimit -l' is set too low.

 Carla.spec       |  2 ++
 mmap_error.patch | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)
---
diff --git a/Carla.spec b/Carla.spec
index 9b7b85b..18a843d 100644
--- a/Carla.spec
+++ b/Carla.spec
@@ -14,6 +14,7 @@ Source0:	https://github.com/falkTX/Carla/archive/%{tag}/%{name}-%{tag}.tar.gz
 Patch0:		pypkgdir.patch
 Patch1:		soundfonts_path.patch
 Patch2:		param_update.patch
+Patch3:		mmap_error.patch
 URL:		http://kxstudio.linuxaudio.org/Applications:Carla
 BuildRequires:	Mesa-libGL-devel
 BuildRequires:	Qt5Core-devel
@@ -65,6 +66,7 @@ Pliki nagłówkowe biblioteki %{name}.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %{__make} -j1 \
diff --git a/mmap_error.patch b/mmap_error.patch
new file mode 100644
index 0000000..41a9d31
--- /dev/null
+++ b/mmap_error.patch
@@ -0,0 +1,18 @@
+diff --git a/source/utils/CarlaShmUtils.hpp b/source/utils/CarlaShmUtils.hpp
+index 71ca6f0f..3ed53159 100644
+--- a/source/utils/CarlaShmUtils.hpp
++++ b/source/utils/CarlaShmUtils.hpp
+@@ -199,7 +199,11 @@ void* carla_shm_map(carla_shm_t& shm, const std::size_t size) noexcept
+ 
+         void* const ptr(::mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_LOCKED, shm.fd, 0));
+ 
+-        if (ptr == nullptr)
++        if (ptr == MAP_FAILED) {
++            carla_stderr("mmap failed: %s", std::strerror(errno));
++            return nullptr;
++        }
++        else if (ptr == nullptr)
+         {
+             carla_safe_assert("ptr != nullptr", __FILE__, __LINE__);
+             return nullptr;
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/Carla.git/commitdiff/a9613353be4f7e890d9bf5ea0030690212bdbe42



More information about the pld-cvs-commit mailing list