migrated autoresume to use get_afl_env

This commit is contained in:
Dominik Maier
2020-03-01 14:09:21 +01:00
parent 6865cd8d69
commit 3e0a3ec45f
4 changed files with 12 additions and 9 deletions

View File

@ -315,6 +315,7 @@ extern u8 skip_deterministic, /* Skip deterministic stages? */
no_forkserver, /* Disable forkserver? */ no_forkserver, /* Disable forkserver? */
crash_mode, /* Crash mode! Yeah! */ crash_mode, /* Crash mode! Yeah! */
in_place_resume, /* Attempt in-place resume? */ in_place_resume, /* Attempt in-place resume? */
autoresume, /* Resume if out_dir exists? */
auto_changed, /* Auto-generated tokens changed? */ auto_changed, /* Auto-generated tokens changed? */
no_cpu_meter_red, /* Feng shui on the status screen */ no_cpu_meter_red, /* Feng shui on the status screen */
no_arith, /* Skip most arithmetic ops */ no_arith, /* Skip most arithmetic ops */

View File

@ -115,6 +115,7 @@ u8 skip_deterministic, /* Skip deterministic stages? */
no_forkserver, /* Disable forkserver? */ no_forkserver, /* Disable forkserver? */
crash_mode, /* Crash mode! Yeah! */ crash_mode, /* Crash mode! Yeah! */
in_place_resume, /* Attempt in-place resume? */ in_place_resume, /* Attempt in-place resume? */
autoresume, /* Resume if out_dir exists? */
auto_changed, /* Auto-generated tokens changed? */ auto_changed, /* Auto-generated tokens changed? */
no_cpu_meter_red, /* Feng shui on the status screen */ no_cpu_meter_red, /* Feng shui on the status screen */
no_arith, /* Skip most arithmetic ops */ no_arith, /* Skip most arithmetic ops */

View File

@ -1066,7 +1066,7 @@ static void handle_existing_out_dir(void) {
/* Autoresume treats a normal run as in_place_resume if a valid out dir already exists */ /* Autoresume treats a normal run as in_place_resume if a valid out dir already exists */
if (getenv("AFL_AUTORESUME")) { if (!in_place_resume && autoresume) {
OKF("Detected prior run with AFL_AUTORESUME set. Resuming."); OKF("Detected prior run with AFL_AUTORESUME set. Resuming.");
in_place_resume = 1; in_place_resume = 1;

View File

@ -314,14 +314,7 @@ int main(int argc, char** argv, char** envp) {
if (in_dir) FATAL("Multiple -i options not supported"); if (in_dir) FATAL("Multiple -i options not supported");
in_dir = optarg; in_dir = optarg;
if (!strcmp(in_dir, "-")) { if (!strcmp(in_dir, "-")) in_place_resume = 1;
if (getenv("AFL_AUTORESUME"))
WARNF("AFL_AUTORESUME has no effect for '-i -'");
in_place_resume = 1;
}
break; break;
@ -757,6 +750,14 @@ int main(int argc, char** argv, char** envp) {
if (get_afl_env("AFL_SHUFFLE_QUEUE")) shuffle_queue = 1; if (get_afl_env("AFL_SHUFFLE_QUEUE")) shuffle_queue = 1;
if (get_afl_env("AFL_FAST_CAL")) fast_cal = 1; if (get_afl_env("AFL_FAST_CAL")) fast_cal = 1;
if (get_afl_env("AFL_AUTORESUME")) {
autoresume = 1;
if (in_place_resume)
WARNF("AFL_AUTORESUME has no effect for '-i -'");
}
if (get_afl_env("AFL_HANG_TMOUT")) { if (get_afl_env("AFL_HANG_TMOUT")) {
hang_tmout = atoi(getenv("AFL_HANG_TMOUT")); hang_tmout = atoi(getenv("AFL_HANG_TMOUT"));