1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

core: handle OOM during deserialization always the same way

OOM failures we consider fatal, while other failures we generally skip
over.
This commit is contained in:
Lennart Poettering 2018-10-09 16:54:40 +02:00
parent b2a8a3dd10
commit 18869883f2

View File

@ -3365,8 +3365,11 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
exec_runtime_deserialize_one(m, val, fds);
else if ((val = startswith(l, "subscribed="))) {
if (strv_extend(&m->deserialized_subscribed, val) < 0)
log_oom();
if (strv_extend(&m->deserialized_subscribed, val) < 0) {
r = -ENOMEM;
goto finish;
}
} else {
ManagerTimestamp q;
@ -3407,18 +3410,20 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
r = manager_load_unit(m, unit_name, NULL, NULL, &u);
if (r < 0) {
log_notice_errno(r, "Failed to load unit \"%s\", skipping deserialization: %m", unit_name);
if (r == -ENOMEM)
goto finish;
log_notice_errno(r, "Failed to load unit \"%s\", skipping deserialization: %m", unit_name);
unit_deserialize_skip(f);
continue;
}
r = unit_deserialize(u, f, fds);
if (r < 0) {
log_notice_errno(r, "Failed to deserialize unit \"%s\": %m", unit_name);
if (r == -ENOMEM)
goto finish;
log_notice_errno(r, "Failed to deserialize unit \"%s\": %m", unit_name);
}
}