1
0
mirror of https://github.com/systemd/systemd synced 2025-10-06 00:13:24 +02:00

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 276d200186.
Fixes #39061.
This commit is contained in:
Yu Watanabe
2025-09-22 00:45:14 +09:00
parent 9b89aee4af
commit 43cea09f95

View File

@@ -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;
}