]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/serialization: call exec_runtime_deserialize_compat() independently of whether...
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 8 Jun 2021 14:28:59 +0000 (16:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 9 Jun 2021 10:54:27 +0000 (12:54 +0200)
There is no reason to tie the two together: in principle we may have
in the future a unit type which does not define .serialize/.deserialize_item,
but we would still want to call the compat deserialization code for it.

src/core/unit-serialize.c

index daf7c59cc15965b25bdfe5756f91a43499a3b17f..f6305d879a36a6fe07109a68f777b5f7acb94e2d 100644 (file)
@@ -498,17 +498,15 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
                         continue;
                 }
 
-                if (unit_can_serialize(u)) {
-                        r = exec_runtime_deserialize_compat(u, l, v, fds);
-                        if (r < 0) {
-                                log_unit_warning(u, "Failed to deserialize runtime parameter '%s', ignoring.", l);
-                                continue;
-                        }
-
+                r = exec_runtime_deserialize_compat(u, l, v, fds);
+                if (r < 0) {
+                        log_unit_warning(u, "Failed to deserialize runtime parameter '%s', ignoring.", l);
+                        continue;
+                } else if (r > 0)
                         /* Returns positive if key was handled by the call */
-                        if (r > 0)
-                                continue;
+                        continue;
 
+                if (unit_can_serialize(u)) {
                         r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
                         if (r < 0)
                                 log_unit_warning(u, "Failed to deserialize unit parameter '%s', ignoring.", l);