From: Yu Watanabe Date: Sun, 21 Sep 2025 15:45:14 +0000 (+0900) Subject: machine: fix crash on update from older than v258 X-Git-Tag: v259-rc1~480 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43cea09f95e5a051432e040c823e945b8b327ed4;p=thirdparty%2Fsystemd.git 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. --- 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; }