fuzz: unify logging setup

Make sure we don't log anything when running in "fuzzing" mode. Also,
when at it, unify the setup logic into a helper, pretty similar to
the test_setup_logging() one.

Addresses:
  - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607
  - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
This commit is contained in:
Frantisek Sumsal
2023-10-19 10:05:20 +01:00
committed by Luca Boccassi
parent 47174dc054
commit 4820c9d417
43 changed files with 60 additions and 99 deletions
+1 -2
View File
@@ -14,8 +14,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (outside_size_range(size, 0, 65536))
return 0;
if (!getenv("SYSTEMD_LOG_LEVEL"))
log_set_max_level(LOG_CRIT);
fuzz_setup_logging();
assert_se(fmkostemp_safe(netdev_config, "r+", &f) == 0);
if (size != 0)