summaryrefslogtreecommitdiffstats
path: root/src/core/swap.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-07-17 19:36:46 +0200
committerLennart Poettering <lennart@poettering.net>2018-07-23 13:36:47 +0200
commit6a1d4d9fa6b9df1069b15f00447b3a8f9b9a3266 (patch)
treef461821c13bd79c9095a166f15def8ca47702446 /src/core/swap.c
parentexecute: document what the different structures are for in comments (diff)
downloadsystemd-6a1d4d9fa6b9df1069b15f00447b3a8f9b9a3266.tar.xz
systemd-6a1d4d9fa6b9df1069b15f00447b3a8f9b9a3266.zip
core: properly reset all ExecStatus structures when entering a new unit cycle
Whenever a unit is started fresh we should flush out any runtime data from the previous cycle. We are pretty good at that already, but what so far we missed was the ExecStart=/ExecStop=/… command exit status data. Let's fix that, and properly flush out that stuff too. Consider this service: [Service] ExecStart=/bin/sleep infinity ExecStop=/bin/false When this service is started, then stopped and then started again "systemctl status" would show the ExecStop= results of the previous run along with the ExecStart= results of the current one, which is very confusing. With this patch this is corrected: the data is kept right until the moment the new service cycle starts, and then flushed out. Hence "systemctl status" in that case will only show the ExecStart= data, but no ExecStop= data, like it should be. This should fix part of the confusion of #9588
Diffstat (limited to 'src/core/swap.c')
-rw-r--r--src/core/swap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index b78b1aa266..f8d6a4dd22 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -853,6 +853,7 @@ static int swap_start(Unit *u) {
return r;
s->result = SWAP_SUCCESS;
+ exec_command_reset_status_array(s->exec_command, _SWAP_EXEC_COMMAND_MAX);
u->reset_accounting = true;