aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorantoine <antoine@FreeBSD.org>2018-01-13 17:53:15 +0800
committerantoine <antoine@FreeBSD.org>2018-01-13 17:53:15 +0800
commite8fd1ddd3fc9d81518cede521ee7add79820f851 (patch)
treebae83fd77ae40b7e69f667c32208c5d0f83f6096 /security
parenta1f2e7d8ac7010ca29dd0ea5c9212afa06494544 (diff)
downloadfreebsd-ports-gnome-e8fd1ddd3fc9d81518cede521ee7add79820f851.tar.gz
freebsd-ports-gnome-e8fd1ddd3fc9d81518cede521ee7add79820f851.tar.zst
freebsd-ports-gnome-e8fd1ddd3fc9d81518cede521ee7add79820f851.zip
Work around sem_unlink bug on FreeBSD when /tmp is using tmpfs
PR: 189353
Diffstat (limited to 'security')
-rw-r--r--security/yara/Makefile1
-rw-r--r--security/yara/files/patch-threading.c37
2 files changed, 38 insertions, 0 deletions
diff --git a/security/yara/Makefile b/security/yara/Makefile
index 56f6c574283c..b1d21e60771f 100644
--- a/security/yara/Makefile
+++ b/security/yara/Makefile
@@ -2,6 +2,7 @@
PORTNAME= yara
PORTVERSION= 3.7.0
+PORTREVISION= 1
DISTVERSIONPREFIX= v
CATEGORIES= security
diff --git a/security/yara/files/patch-threading.c b/security/yara/files/patch-threading.c
new file mode 100644
index 000000000000..65a26bbbf3a1
--- /dev/null
+++ b/security/yara/files/patch-threading.c
@@ -0,0 +1,37 @@
+# Work around FreeBSD bug #189353 when /tmp is using tmpfs(5)
+
+--- threading.c.orig 2017-11-10 11:21:21 UTC
++++ threading.c
+@@ -33,6 +33,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
+ #include <errno.h>
+ #endif
+
++#if defined(__FreeBSD__)
++#include <stdlib.h>
++#endif
++
+ #include "threading.h"
+
+
+@@ -88,6 +92,11 @@ int semaphore_init(
+ *semaphore = CreateSemaphore(NULL, value, 65535, NULL);
+ if (*semaphore == NULL)
+ return GetLastError();
++ #elif defined(__FreeBSD__)
++ *semaphore = malloc(sizeof(sem_t));
++ if (*semaphore == NULL)
++ return errno;
++ return sem_init(*semaphore, 0, value);
+ #else
+ // Mac OS X doesn't support unnamed semaphores via sem_init, that's why
+ // we use sem_open instead sem_init and immediately unlink the semaphore
+@@ -112,6 +121,9 @@ void semaphore_destroy(
+ {
+ #if defined(_WIN32) || defined(__CYGWIN__)
+ CloseHandle(*semaphore);
++ #elif defined(__FreeBSD__)
++ sem_close(*semaphore);
++ free(*semaphore);
+ #else
+ sem_close(*semaphore);
+ #endif