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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user