about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--docs/Changelog.md4
-rw-r--r--include/afl-record-compat.h4
-rw-r--r--src/afl-fuzz.c20
3 files changed, 17 insertions, 11 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 51f8dc4f..94ea5fca 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -8,7 +8,7 @@
     backward compatible to old compiled targets if they are not built
     for CMPLOG/Redqueen, but new compiled targets will not work with
     old afl-fuzz versions!
-  ! Recompiled all targets that are instrumented for CMPLOG/Redqueen!
+  ! Recompile all targets that are instrumented for CMPLOG/Redqueen!
   - AFL++ now supports up to 4 billion coverage edges, up from 6 million.
   - New compile option: `make PERFORMANCE=1` - this will enable special
     CPU dependent optimizations that make everything more performant - but
@@ -23,7 +23,7 @@
     - workround for a bug with MOpt -L when used with -M - in the future
       we will either remove or rewrite MOpt.
     - fix for `-t xxx+` feature
-    - -e extension option now saves the queue items crashes etc. with the
+    - -e extension option now saves the queue items, crashes, etc. with the
       extension too
   - afl-cc:
     - added collision free caller instrumentation to LTO mode. activate with
diff --git a/include/afl-record-compat.h b/include/afl-record-compat.h
index 2c79595d..3e5d60e3 100644
--- a/include/afl-record-compat.h
+++ b/include/afl-record-compat.h
@@ -28,7 +28,7 @@ int __afl_persistent_loop(unsigned int max_cnt) {
   static unsigned short int inited = 0;
   char                      tcase[PATH_MAX];
 
-  if (is_replay_record) {
+  if (is_replay_record && cycle_cnt) {
 
     if (!inited) {
 
@@ -59,7 +59,7 @@ int __afl_persistent_loop(unsigned int max_cnt) {
 
   }
 
-  return --cycle_cnt;
+  return cycle_cnt--;
 
 }
 
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 443d93b0..99491628 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -2073,6 +2073,17 @@ int main(int argc, char **argv_orig, char **envp) {
 
   }
 
+  /* Simply code if AFL_TMPDIR is used or not */
+  if (!afl->afl_env.afl_tmpdir) {
+
+    afl->tmp_dir = afl->out_dir;
+
+  } else {
+
+    afl->tmp_dir = afl->afl_env.afl_tmpdir;
+
+  }
+
   write_setup_file(afl, argc, argv);
 
   setup_cmdline_file(afl, argv + optind);
@@ -2085,8 +2096,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   if (!afl->timeout_given) { find_timeout(afl); }  // only for resumes!
 
-  if ((afl->tmp_dir = afl->afl_env.afl_tmpdir) != NULL &&
-      !afl->in_place_resume) {
+  if (afl->afl_env.afl_tmpdir && !afl->in_place_resume) {
 
     char tmpfile[PATH_MAX];
 
@@ -2111,10 +2121,6 @@ int main(int argc, char **argv_orig, char **envp) {
 
     }
 
-  } else {
-
-    afl->tmp_dir = afl->out_dir;
-
   }
 
   /* If we don't have a file name chosen yet, use a safe default. */
@@ -3068,7 +3074,7 @@ stop_fuzzing:
   afl_fsrv_deinit(&afl->fsrv);
 
   /* remove tmpfile */
-  if (afl->tmp_dir != NULL && !afl->in_place_resume && afl->fsrv.out_file) {
+  if (!afl->in_place_resume && afl->fsrv.out_file) {
 
     (void)unlink(afl->fsrv.out_file);