]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: handle OOM during deserialization always the same way
authorLennart Poettering <lennart@poettering.net>
Tue, 9 Oct 2018 14:54:40 +0000 (16:54 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 Oct 2018 17:43:43 +0000 (19:43 +0200)
OOM failures we consider fatal, while other failures we generally skip
over.

src/core/manager.c

index e1568e747f0bcfa65349986618ebb5b1029a3e9a..48fca6225200846cd5b09adbebffc439bb2dde68 100644 (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);
                 }
         }