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: v258.1~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ebc1de3fb816b19225d51d2f6e8821e030a6fd0;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. (cherry picked from commit 43cea09f95e5a051432e040c823e945b8b327ed4) --- diff --git a/src/machine/machine.c b/src/machine/machine.c index 1ce906b7a2a..84a5e4915f0 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -404,9 +404,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; }