Simple diff to remove syscall(2) in afl++. Feedback, ok?

diff --git a/devel/afl++/Makefile b/devel/afl++/Makefile
index a2fdee6fd1a..bb07eef88d0 100644
--- a/devel/afl++/Makefile
+++ b/devel/afl++/Makefile
@@ -6,7 +6,7 @@ GH_PROJECT =    AFLplusplus
 GH_TAGNAME =   4.05c
 PKGNAME =      afl++-${GH_TAGNAME}
 CATEGORIES=    devel
-REVISION =     0
+REVISION =     1
 
 HOMEPAGE=      https://aflplus.plus/
 MAINTAINER=    Jasper Lievisse Adriaanse <[email protected]>
diff --git a/devel/afl++/patches/patch-GNUmakefile 
b/devel/afl++/patches/patch-GNUmakefile
index 88961770ab1..6ccb373a7ab 100644
--- a/devel/afl++/patches/patch-GNUmakefile
+++ b/devel/afl++/patches/patch-GNUmakefile
@@ -14,12 +14,12 @@ Index: GNUmakefile
  
  PROGNAME    = afl
  VERSION     = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' 
-f2)
-@@ -305,7 +305,7 @@ ifdef TEST_MMAP
+@@ -306,7 +306,7 @@ ifdef TEST_MMAP
  endif
  
  .PHONY: all
 -all:  test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin 
test_build all_done
 +all:  test_x86 test_shm test_python ready $(PROGS) afl-as llvm
        -$(MAKE) -C utils/aflpp_driver
- 
- .PHONY: llvm
+       @echo
+       @echo
diff --git a/devel/afl++/patches/patch-instrumentation_afl-compiler-rt_o_c 
b/devel/afl++/patches/patch-instrumentation_afl-compiler-rt_o_c
new file mode 100644
index 00000000000..2fb69568d00
--- /dev/null
+++ b/devel/afl++/patches/patch-instrumentation_afl-compiler-rt_o_c
@@ -0,0 +1,14 @@
+Index: instrumentation/afl-compiler-rt.o.c
+--- instrumentation/afl-compiler-rt.o.c.orig
++++ instrumentation/afl-compiler-rt.o.c
+@@ -1997,7 +1997,9 @@ static int area_is_valid(void *ptr, size_t len) {
+ 
+   if (unlikely(!ptr || __asan_region_is_poisoned(ptr, len))) { return 0; }
+ 
+-#ifndef __HAIKU__
++#ifdef __OpenBSD__
++  long r = write(__afl_dummy_fd[1], ptr, len);
++#elif !defined(__HAIKU__)
+   long r = syscall(SYS_write, __afl_dummy_fd[1], ptr, len);
+ #else
+   long r = _kern_write(__afl_dummy_fd[1], -1, ptr, len);
diff --git a/devel/afl++/patches/patch-utils_aflpp_driver_aflpp_driver_c 
b/devel/afl++/patches/patch-utils_aflpp_driver_aflpp_driver_c
new file mode 100644
index 00000000000..1b84cc3ee34
--- /dev/null
+++ b/devel/afl++/patches/patch-utils_aflpp_driver_aflpp_driver_c
@@ -0,0 +1,14 @@
+Index: utils/aflpp_driver/aflpp_driver.c
+--- utils/aflpp_driver/aflpp_driver.c.orig
++++ utils/aflpp_driver/aflpp_driver.c
+@@ -216,7 +216,9 @@ static int ExecuteFilesOnyByOne(int argc, char **argv,
+ 
+     if (fd == -1) { continue; }
+ 
+-#ifndef __HAIKU__
++#ifdef __OpenBSD__
++    ssize_t length = read(fd, buf, MAX_FILE);
++#elif !defined(__HAIKU__)
+     ssize_t length = syscall(SYS_read, fd, buf, MAX_FILE);
+ #else
+     ssize_t length = _kern_read(fd, buf, MAX_FILE);

Reply via email to