summaryrefslogtreecommitdiff
path: root/src/fuzz
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-02 14:55:12 +0200
committerLennart Poettering <lennart@poettering.net>2020-06-02 19:32:20 +0200
commit4f9ff96a55187927a4164a19df580329f4c6522b (patch)
treec3e1face3267f1d965bc4328f4a1a9c1b2427aee /src/fuzz
parent5aca2e6733d35534f82359e5720b3dea1d1332e5 (diff)
downloadsystemd-4f9ff96a55187927a4164a19df580329f4c6522b.tar.gz
conf-parser: return mtime in config_parse() and friends
This is a follow-up for 9f83091e3cceb646a66fa9df89de6d9a77c21d86. Instead of reading the mtime off the configuration files after reading, let's do so before reading, but with the fd we read the data from. This is not only cleaner (as it allows us to save one stat()), but also has the benefit that we'll detect changes that happen while we read the files. This also reworks unit file drop-ins to use the common code for determining drop-in mtime, instead of reading system clock for that.
Diffstat (limited to 'src/fuzz')
-rw-r--r--src/fuzz/fuzz-unit-file.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/fuzz/fuzz-unit-file.c b/src/fuzz/fuzz-unit-file.c
index d3993cf123..34f59a4437 100644
--- a/src/fuzz/fuzz-unit-file.c
+++ b/src/fuzz/fuzz-unit-file.c
@@ -70,10 +70,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
name = strjoina("a.", unit_type_to_string(t));
assert_se(unit_new_for_name(m, unit_vtable[t]->object_size, name, &u) >= 0);
- (void) config_parse(name, name, f,
- UNIT_VTABLE(u)->sections,
- config_item_perf_lookup, load_fragment_gperf_lookup,
- CONFIG_PARSE_ALLOW_INCLUDE, u);
+ (void) config_parse(
+ name, name, f,
+ UNIT_VTABLE(u)->sections,
+ config_item_perf_lookup, load_fragment_gperf_lookup,
+ CONFIG_PARSE_ALLOW_INCLUDE,
+ u,
+ NULL);
g = open_memstream_unlocked(&out, &out_size);
assert_se(g);