summaryrefslogtreecommitdiff
path: root/fuzz.c
diff options
context:
space:
mode:
authorRobert Swiecki <robert@swiecki.net>2018-01-12 02:23:42 +0100
committerRobert Swiecki <robert@swiecki.net>2018-01-12 02:23:42 +0100
commitfff99812642a7eb30f127c5f84110e7a2b5e6bd3 (patch)
treedc44bcf6cc126ac1d98bac2c1a4337a31eadc821 /fuzz.c
parent28cc4cb142b49a429ebda69cbe55f9a34ff30ef8 (diff)
downloadhonggfuzz-fff99812642a7eb30f127c5f84110e7a2b5e6bd3.tar.gz
fuzz: correct test for files_exists
Diffstat (limited to 'fuzz.c')
-rw-r--r--fuzz.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fuzz.c b/fuzz.c
index 1a9038b0..f0014f1a 100644
--- a/fuzz.c
+++ b/fuzz.c
@@ -238,15 +238,14 @@ static bool fuzz_writeCovFile(const char* dir, const uint8_t* data, size_t len)
snprintf(fname, sizeof(fname), "%s/%016" PRIx64 "%016" PRIx64 ".%08" PRIx32 ".honggfuzz.cov",
dir, crc64f, crc64r, (uint32_t)len);
- if (files_exists(fname) == 0) {
+ if (files_exists(fname)) {
LOG_D("File '%s' already exists in the output corpus directory '%s'", fname, dir);
return true;
}
LOG_D("Adding file '%s' to the corpus directory '%s'", fname, dir);
- if (files_writeBufToFile(fname, data, len, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC) ==
- false) {
+ if (!files_writeBufToFile(fname, data, len, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC)) {
LOG_W("Couldn't write buffer to file '%s'", fname);
return false;
}