Skip to content

Commit

Permalink
fuzz-journal-remote: write to /dev/null not stdout
Browse files Browse the repository at this point in the history
This makes the fuzzing much more efficient.
The case from 056129d is still detected properly.
  • Loading branch information
keszybz committed May 21, 2018
1 parent 7b6a624 commit 1ac4c7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fuzz/fuzz-journal-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "strv.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_fclose_ FILE *dev_null = NULL;
RemoteServer s = {};
char name[] = "/tmp/fuzz-journal-remote.XXXXXX.journal";
void *mem;
Expand Down Expand Up @@ -47,8 +48,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
r = sd_journal_open_files(&j, (const char**) STRV_MAKE(name), 0);
assert_se(r >= 0);

assert_se(dev_null = fopen("/dev/null", "w"));

for (mode = 0; mode < _OUTPUT_MODE_MAX; mode++) {
r = show_journal(stdout, j, mode, 0, 0, -1, 0, NULL);
r = show_journal(dev_null, j, mode, 0, 0, -1, 0, NULL);
assert_se(r >= 0);

r = sd_journal_seek_head(j);
Expand Down

0 comments on commit 1ac4c7d

Please sign in to comment.