diff options
| author | auric <auric7@protonmail.com> | 2026-02-22 19:00:47 -0600 |
|---|---|---|
| committer | auric <auric7@protonmail.com> | 2026-02-22 19:00:47 -0600 |
| commit | 00f81b274958d9a8398a4213985a25be067fe7f9 (patch) | |
| tree | dee26b85ab66905ccc626139a5da61689eb329e5 | |
| parent | 82cf12f471e5e7768a6e8d2a412a0bb750a21bf9 (diff) | |
Fix YAML parser not reading log paths from sequence
Sequence items arrive as SCALAR events with in_value==0 (no preceding
key), so they were being treated as keys and silently discarded.
Handle SECTION_LOGS scalars directly as list items when in_value is
unset, leaving the normal key/value path for all other sections.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | src/unit.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -135,6 +135,13 @@ int unit_load_file(const char *path, Unit *out) { const char *val = (const char *)event.data.scalar.value; if (!in_value) { + /* Sequence items (logs list) arrive as scalars without a + * preceding key — handle them directly as values */ + if (section == SECTION_LOGS) { + if (out->log_count < 4) + strncpy(out->log_paths[out->log_count++], val, + MAX_PATH - 1); + } else { /* This is a key */ strncpy(last_key, val, sizeof(last_key) - 1); @@ -149,6 +156,7 @@ int unit_load_file(const char *path, Unit *out) { section = SECTION_ACTIONS; else in_value = 1; + } } else { /* This is a value */ in_value = 0; |
