summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Kang <jonathankang@gnome.org>2020-10-22 11:02:31 +0800
committerRichard Hughes <richard@hughsie.com>2020-10-28 13:47:16 +0000
commit8b621738a51bcb7a9fa215865cacbd7846a373b1 (patch)
tree24ad9808e4a7ae1fc54180887303344f5b4c9711 /src
parente77078c7b926f6b1b06b358a694afde5390b9241 (diff)
main: notify the service manager when it's beginning to shutdown
This makes sure that the main process won't get SIGTERM on shutdown, for example timed exit after idling for a while. This fix the problem that libzypp fails to clean up some temporary files when packagekitd quits.
Diffstat (limited to 'src')
-rw-r--r--src/pk-main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pk-main.c b/src/pk-main.c
index 5791c5fef..41c01981b 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -32,6 +32,9 @@
#include <glib-unix.h>
#include <glib/gi18n.h>
#include <packagekit-glib2/pk-debug.h>
+#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#include <systemd/sd-daemon.h>
+#endif
#include "pk-engine.h"
#include "pk-shared.h"
@@ -245,6 +248,10 @@ out:
syslog (LOG_DAEMON | LOG_DEBUG, "daemon quit");
closelog ();
+#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+ sd_notify (0, "STOPPING=1");
+#endif
+
if (helper.timer_id > 0)
g_source_remove (helper.timer_id);
if (loop != NULL)