merge PR#306 from neoni (thanks), silence test when bash is not found
MODIFY
src/afl-fuzz-init.c
src/afl-fuzz-init.c
@@ -134,8 +134,17 @@ void bind_to_free_cpu(afl_state_t *afl) {
for (i = 0; i < proccount; i++) {
#if defined(__FreeBSD__)
- if (procs[i].ki_oncpu < sizeof(cpu_used) && procs[i].ki_pctcpu > 60)
- cpu_used[procs[i].ki_oncpu] = 1;
+ if (!strcmp(procs[i].ki_comm, "idle"))
+ continue;
+
+ // fix when ki_oncpu = -1
+ int oncpu;
+ oncpu = procs[i].ki_oncpu;
+ if (oncpu == -1)
+ oncpu = procs[i].ki_lastcpu;
+
+ if (oncpu != -1 && oncpu < sizeof(cpu_used) && procs[i].ki_pctcpu > 60)
+ cpu_used[oncpu] = 1;
#elif defined(__DragonFly__)
if (procs[i].kp_lwp.kl_cpuid < sizeof(cpu_used) &&
procs[i].kp_lwp.kl_pctcpu > 10)

MODIFY
test/test.sh
test/test.sh
@@ -185,7 +185,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
esac
rm -f in2/in*
export AFL_QUIET=1
- if type bash >/dev/null ; then {
+ if command -v bash >/dev/null ; then {
AFL_PATH=`pwd`/.. ../afl-cmin.bash -m ${MEM_LIMIT} -i in -o in2 -- ./test-instr.plain >/dev/null
CNT=`ls in2/* 2>/dev/null | wc -l`
case "$CNT" in

merge PR#306 from neoni (thanks), silence test when bash is not found