diff options
author | Robert Swiecki <robert@swiecki.net> | 2018-01-12 02:30:14 +0100 |
---|---|---|
committer | Robert Swiecki <robert@swiecki.net> | 2018-01-12 02:30:14 +0100 |
commit | 965af7f53fe5f065bc76263d0f3383f99eb664a3 (patch) | |
tree | 26d79ce21686d83257690f8c9d967f80a5436b44 /fuzz.c | |
parent | fff99812642a7eb30f127c5f84110e7a2b5e6bd3 (diff) | |
download | honggfuzz-965af7f53fe5f065bc76263d0f3383f99eb664a3.tar.gz |
fuzz: leave the original file in place after verification, so subsequent fuzzing will not report old findings as new
Diffstat (limited to 'fuzz.c')
-rw-r--r-- | fuzz.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -403,11 +403,7 @@ static bool fuzz_runVerifier(run_t* run) { snprintf(verFile, sizeof(verFile), "%s.verified", origCrashPath); if (files_exists(verFile)) { - LOG_D("Crash file to verify '%s' is already verified as '%s'. Removing it", origCrashPath, - verFile); - if (unlink(origCrashPath) == -1) { - PLOG_E("unlink('%s')", origCrashPath); - } + LOG_D("Crash file to verify '%s' is already verified as '%s'", origCrashPath, verFile); return false; } @@ -441,10 +437,10 @@ static bool fuzz_runVerifier(run_t* run) { PLOG_E("Couldn't create '%s'", verFile); return true; } - close(fd); - - if (rename(origCrashPath, verFile) == -1) { - PLOG_E("rename('%s', '%s')", origCrashPath, verFile); + defer { close(fd); } + if (!files_writeToFd(fd, run->dynamicFile, run->dynamicFileSz)) { + LOG_E("Couldn't save verified file as '%s'", verFile); + unlink(verFile); return true; } |