aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Kortkamp <t@tobik.me>2019-09-05 10:49:47 +0200
committerTobias Kortkamp <t@tobik.me>2019-09-05 10:49:47 +0200
commitc8c5ec254af581814037d9853ad76975258d29ae (patch)
treee19c68cea20700c7e93452a420532444844050d9 /src
parent1a0b491ed6d8a694b78b313f115f0650d6854418 (diff)
downloadafl++-c8c5ec254af581814037d9853ad76975258d29ae.tar.gz
Unbreak build of afl-forkserver.c on *BSD
Signed-off-by: Tobias Kortkamp <t@tobik.me>
Diffstat (limited to 'src')
-rw-r--r--src/afl-forkserver.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index f2f3c0f0..64b8430d 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -40,12 +40,18 @@
#include <sys/wait.h>
#include <sys/resource.h>
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#define HAVE_ARC4RANDOM 1
+#endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */
+
/* a program that includes afl-forkserver needs to define these */
extern u8 uses_asan;
extern u8 *trace_bits;
extern s32 forksrv_pid, child_pid, fsrv_ctl_fd, fsrv_st_fd;
-extern s32 out_fd, out_dir_fd, dev_urandom_fd,
- dev_null_fd; /* initialize these with -1 */
+extern s32 out_fd, out_dir_fd, dev_null_fd; /* initialize these with -1 */
+#ifndef HAVE_ARC4RANDOM
+extern s32 dev_random_fd;
+#endif
extern u32 exec_tmout;
extern u64 mem_limit;
extern u8 * out_file, *target_path, *doc_path;
@@ -232,7 +238,9 @@ void init_forkserver(char **argv) {
close(out_dir_fd);
close(dev_null_fd);
+#ifndef HAVE_ARC4RANDOM
close(dev_urandom_fd);
+#endif
close(plot_file == NULL ? -1 : fileno(plot_file));
/* This should improve performance a bit, since it stops the linker from