about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile2
-rw-r--r--src/afl-common.c8
-rwxr-xr-xtest/test.sh2
3 files changed, 6 insertions, 6 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 8f559391..dd817d35 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -101,7 +101,7 @@ endif
 
 ifeq "$(shell uname -s)" "OpenBSD"
   override CFLAGS  += -I /usr/local/include/
-  LDFLAGS += -L /usr/local/lib/
+  LDFLAGS += -Wl,-z,notext -L /usr/local/lib/
 endif
 
 ifeq "$(shell uname -s)" "NetBSD"
diff --git a/src/afl-common.c b/src/afl-common.c
index 1bb58a60..9fd4bf03 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -885,9 +885,9 @@ u32 read_timed(s32 fd, void *buf, size_t len, u32 timeout_ms,
   timeout.tv_usec = (timeout_ms % 1000) * 1000;
 
   size_t read_total = 0;
-  size_t len_read = 0;
+  ssize_t len_read = 0;
 
-  while (len_read < len) {
+  while (read_total < len) {
 
     /* set exceptfds as well to return when a child exited/closed the pipe. */
     int sret = select(fd + 1, &readfds, NULL, NULL, &timeout);
@@ -905,8 +905,8 @@ u32 read_timed(s32 fd, void *buf, size_t len, u32 timeout_ms,
 
     }
 
-    len_read = read(fd, ((u8 *)buf) + len_read, len - len_read);
-    if (!len_read) { return 0; }
+    len_read = read(fd, ((u8 *)buf) + read_total, len - read_total);
+    if (len_read <= 0) { return 0; }
     read_total += len_read;
 
   }
diff --git a/test/test.sh b/test/test.sh
index 7f1410ea..431e3983 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -115,7 +115,7 @@ $ECHO "${RESET}${GREY}[*] starting afl++ test framework ..."
 test -z "$SYS" && $ECHO "$YELLOW[-] uname -m did not succeed"
 
 $ECHO "$BLUE[*] Testing: ${AFL_GCC}, afl-showmap, afl-fuzz, afl-cmin and afl-tmin"
-test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc" && {
+test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc" -o "$SYS" = "i386" && {
  test -e ../${AFL_GCC} -a -e ../afl-showmap -a -e ../afl-fuzz && {
   ../${AFL_GCC} -o test-instr.plain ../test-instr.c > /dev/null 2>&1
   AFL_HARDEN=1 ../${AFL_GCC} -o test-compcov.harden test-compcov.c > /dev/null 2>&1