core: drop redundant pidref_done() calls

{service,socket}_unwatch_control_pid() -> unit_unwatch_pidref_done()
is unconditionally called everywhere.
This commit is contained in:
Mike Yuan
2025-11-04 12:17:31 +01:00
parent 16a0cbe915
commit 1773d2a207
2 changed files with 0 additions and 18 deletions
-8
View File
@@ -2207,7 +2207,6 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
s->control_command = s->exec_command[SERVICE_EXEC_STOP_POST];
if (s->control_command) {
s->control_command_id = SERVICE_EXEC_STOP_POST;
pidref_done(&s->control_pid);
r = service_spawn(s,
s->control_command,
@@ -2320,7 +2319,6 @@ static void service_enter_stop(Service *s, ServiceResult f) {
s->control_command = s->exec_command[SERVICE_EXEC_STOP];
if (s->control_command) {
s->control_command_id = SERVICE_EXEC_STOP;
pidref_done(&s->control_pid);
r = service_spawn(s,
s->control_command,
@@ -2406,7 +2404,6 @@ static void service_enter_start_post(Service *s) {
s->control_command = s->exec_command[SERVICE_EXEC_START_POST];
if (s->control_command) {
s->control_command_id = SERVICE_EXEC_START_POST;
pidref_done(&s->control_pid);
r = service_spawn(s,
s->control_command,
@@ -2540,7 +2537,6 @@ static void service_enter_start(Service *s) {
case SERVICE_FORKING:
/* For forking services we wait until the start process exited. */
pidref_done(&s->control_pid);
s->control_pid = TAKE_PIDREF(pidref);
return service_set_state(s, SERVICE_START);
@@ -2614,7 +2610,6 @@ static void service_enter_condition(Service *s) {
goto fail;
s->control_command_id = SERVICE_EXEC_CONDITION;
pidref_done(&s->control_pid);
r = service_spawn(s,
s->control_command,
@@ -2735,7 +2730,6 @@ static void service_enter_reload_signal_exec(Service *s) {
s->control_command = s->exec_command[SERVICE_EXEC_RELOAD];
if (s->control_command) {
s->control_command_id = SERVICE_EXEC_RELOAD;
pidref_done(&s->control_pid);
r = service_spawn(s,
s->control_command,
@@ -2898,8 +2892,6 @@ static void service_run_next_control(Service *s) {
else
timeout = s->timeout_stop_usec;
pidref_done(&s->control_pid);
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
-10
View File
@@ -2148,8 +2148,6 @@ static void socket_enter_stop_post(Socket *s, SocketResult f) {
s->control_command = s->exec_command[SOCKET_EXEC_STOP_POST];
if (s->control_command) {
pidref_done(&s->control_pid);
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to spawn 'stop-post' task: %m");
@@ -2226,8 +2224,6 @@ static void socket_enter_stop_pre(Socket *s, SocketResult f) {
s->control_command = s->exec_command[SOCKET_EXEC_STOP_PRE];
if (s->control_command) {
pidref_done(&s->control_pid);
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to spawn 'stop-pre' task: %m");
@@ -2289,8 +2285,6 @@ static void socket_enter_start_post(Socket *s) {
s->control_command = s->exec_command[SOCKET_EXEC_START_POST];
if (s->control_command) {
pidref_done(&s->control_pid);
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to spawn 'start-post' task: %m");
@@ -2363,8 +2357,6 @@ static void socket_enter_start_pre(Socket *s) {
s->control_command = s->exec_command[SOCKET_EXEC_START_PRE];
if (s->control_command) {
pidref_done(&s->control_pid);
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to spawn 'start-pre' task: %m");
@@ -2612,8 +2604,6 @@ static void socket_run_next(Socket *s) {
s->control_command = s->control_command->command_next;
pidref_done(&s->control_pid);
r = socket_spawn(s, s->control_command, &s->control_pid);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to spawn next task: %m");