]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: add missing serialization for notify_state
authorMike Yuan <me@yhndnzj.com>
Sun, 19 Oct 2025 19:56:33 +0000 (21:56 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 4 Nov 2025 11:17:32 +0000 (12:17 +0100)
This really should be persisted across daemon-reload since
it might contain deferred state transitions.

src/core/service.c

index a8c6883294e35488d7a5fa86509fc44939fcc9d5..644c9e4155606d16596ab9c19d5d7317aa54ed44 100644 (file)
@@ -3298,6 +3298,8 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
 
         if (s->notify_access_override >= 0)
                 (void) serialize_item(f, "notify-access-override", notify_access_to_string(s->notify_access_override));
+        if (s->notify_state >= 0)
+                (void) serialize_item(f, "notify-state", notify_state_to_string(s->notify_state));
 
         r = serialize_item_escaped(f, "status-text", s->status_text);
         if (r < 0)
@@ -3608,6 +3610,16 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
                         log_unit_debug(u, "Failed to parse notify-access-override value: %s", value);
                 else
                         s->notify_access_override = notify_access;
+
+        } else if (streq(key, "notify-state")) {
+                NotifyState notify_state;
+
+                notify_state = notify_state_from_string(value);
+                if (notify_state < 0)
+                        log_unit_debug(u, "Failed to parse notify-state value: %s", value);
+                else
+                        s->notify_state = notify_state;
+
         } else if (streq(key, "n-restarts")) {
                 r = safe_atou(value, &s->n_restarts);
                 if (r < 0)