Patch added for proper mmap() error handling auto/th/Carla-2.0-0.beta6.3
authorJacek Konieczny <j.konieczny@eggsoft.pl>
Thu, 1 Mar 2018 10:18:57 +0000 (11:18 +0100)
committerJacek Konieczny <j.konieczny@eggsoft.pl>
Thu, 1 Mar 2018 10:18:57 +0000 (11:18 +0100)
Fixes mysterious crashes when 'ulimit -l' is set too low.

Carla.spec
mmap_error.patch [new file with mode: 0644]

index 9b7b85b..18a843d 100644 (file)
@@ -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 (file)
index 0000000..41a9d31
--- /dev/null
@@ -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;
+
This page took 0.152116 seconds and 4 git commands to generate.