]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/socket: use correct kill operation for SOCKET_STOP_PRE_SIGTERM
authorMike Yuan <me@yhndnzj.com>
Tue, 17 Dec 2024 12:51:24 +0000 (13:51 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 30 Dec 2024 20:43:52 +0000 (21:43 +0100)
Follow-up for a232ebcc2cd3d5e16b0d0fb0be61549f25fb8239

src/core/socket.c

index 446d3bf9a9e39adca2123c76144af00cca68499f..9234a9187657243bc14b812c33f2245726925c34 100644 (file)
@@ -2104,8 +2104,10 @@ static void socket_enter_stop_post(Socket *s, SocketResult f) {
 }
 
 static int state_to_kill_operation(Socket *s, SocketState state) {
-        if (state == SOCKET_STOP_PRE_SIGTERM && unit_has_job_type(UNIT(s), JOB_RESTART))
-                return KILL_RESTART;
+        assert(s);
+
+        if (state == SOCKET_STOP_PRE_SIGTERM)
+                return unit_has_job_type(UNIT(s), JOB_RESTART) ? KILL_RESTART : KILL_TERMINATE;
 
         if (state == SOCKET_FINAL_SIGTERM)
                 return KILL_TERMINATE;