chiark / gitweb /
service: remove pidfile after exit of a service
authorLukas Nykryn <lnykryn@redhat.com>
Wed, 28 Aug 2013 17:27:44 +0000 (19:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Sep 2013 14:58:04 +0000 (16:58 +0200)
TODO
src/core/service.c

diff --git a/TODO b/TODO
index b83fd67..59e0f97 100644 (file)
--- a/TODO
+++ b/TODO
@@ -60,8 +60,6 @@ Features:
 
 * better error message if you run systemctl without systemd running
 
-* unlink PID files of units after exit
-
 * tiny tool that saves/restores backlight
 
 * systemctl status output should should include list of triggering units and their status
index 4070fd7..34dde79 100644 (file)
@@ -1957,6 +1957,12 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
         /* we want fresh tmpdirs in case service is started again immediately */
         exec_context_tmp_dirs_done(&s->exec_context);
 
+        /* Try to delete the pid file. At this point it will be
+         * out-of-date, and some software might be confused by it, so
+         * let's remove it. */
+        if (s->pid_file)
+                unlink_noerrno(s->pid_file);
+
         return;
 
 fail: