summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorauric <auric@japegames.com>2026-02-22 19:00:47 -0600
committerauric <auric@japegames.com>2026-02-22 19:00:47 -0600
commitf0baf8f2f3778d21692d377d32bd4e372cef2aae (patch)
treedee26b85ab66905ccc626139a5da61689eb329e5 /src
parent3768dd71501e3485b9c2b7557e48a9438b18cb3c (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>
Diffstat (limited to 'src')
-rw-r--r--src/unit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/unit.c b/src/unit.c
index 5baea20..429c2ce 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -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;