svn commit: r458923 - in head/security/yara: . files
Antoine Brodin
antoine at FreeBSD.org
Sat Jan 13 09:53:16 UTC 2018
Author: antoine
Date: Sat Jan 13 09:53:15 2018
New Revision: 458923
URL: https://svnweb.freebsd.org/changeset/ports/458923
Log:
Work around sem_unlink bug on FreeBSD when /tmp is using tmpfs
PR: 189353
Added:
head/security/yara/files/
head/security/yara/files/patch-threading.c (contents, props changed)
Modified:
head/security/yara/Makefile
Modified: head/security/yara/Makefile
==============================================================================
--- head/security/yara/Makefile Sat Jan 13 09:47:41 2018 (r458922)
+++ head/security/yara/Makefile Sat Jan 13 09:53:15 2018 (r458923)
@@ -2,6 +2,7 @@
PORTNAME= yara
PORTVERSION= 3.7.0
+PORTREVISION= 1
DISTVERSIONPREFIX= v
CATEGORIES= security
Added: head/security/yara/files/patch-threading.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/yara/files/patch-threading.c Sat Jan 13 09:53:15 2018 (r458923)
@@ -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
More information about the svn-ports-all
mailing list