From 43cea09f95e5a051432e040c823e945b8b327ed4 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 22 Sep 2025 00:45:14 +0900 Subject: [PATCH] machine: fix crash on update from older than v258 UID entry in the machine state file is introduced in v258, hence when a host is upgraded to v258, the field does not exist in the file, thus the variable 'uid' is NULL. Follow-up for 276d20018623ef14956ce87975be48da5de63f29. Fixes #39061. --- src/machine/machine.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/machine/machine.c b/src/machine/machine.c index 69e7c475af1..e651026fa9d 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -403,9 +403,11 @@ int machine_load(Machine *m) { log_warning_errno(r, "Failed to parse AF_VSOCK CID, ignoring: %s", vsock_cid); } - r = parse_uid(uid, &m->uid); - if (r < 0) - log_warning_errno(r, "Failed to parse owning UID, ignoring: %s", uid); + if (uid) { + r = parse_uid(uid, &m->uid); + if (r < 0) + log_warning_errno(r, "Failed to parse owning UID, ignoring: %s", uid); + } return r; } -- 2.47.3