summaryrefslogtreecommitdiffstats
path: root/daemons
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-03-15 08:45:55 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2012-03-15 08:45:55 +0000
commit08e846e3d9103156eb3458e6731f978415a934b0 (patch)
tree315ada17aa3fe39a1d069f4ffaed1f84cb8176b4 /daemons
parent909887be5ee496d2377ad28ecf981ae4efefb7f0 (diff)
downloadlvm2-08e846e3d9103156eb3458e6731f978415a934b0.tar.gz
lvm2-08e846e3d9103156eb3458e6731f978415a934b0.tar.xz
lvm2-08e846e3d9103156eb3458e6731f978415a934b0.zip
Remove dmeventd fifos on exit if they are not managed by systemd.
Diffstat (limited to 'daemons')
-rw-r--r--daemons/dmeventd/dmeventd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 0b3da1e4..ab9d23d3 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1741,10 +1741,18 @@ out:
}
#endif
-static void remove_lockfile(void)
+static void _remove_files_on_exit(void)
{
if (unlink(DMEVENTD_PIDFILE))
perror(DMEVENTD_PIDFILE ": unlink failed");
+
+ if (!_systemd_activation) {
+ if (unlink(DM_EVENT_FIFO_CLIENT))
+ perror(DM_EVENT_FIFO_CLIENT " : unlink failed");
+
+ if (unlink(DM_EVENT_FIFO_SERVER))
+ perror(DM_EVENT_FIFO_SERVER " : unlink failed");
+ }
}
static void _daemonize(void)
@@ -1955,10 +1963,11 @@ int main(int argc, char *argv[])
if (dm_create_lockfile(DMEVENTD_PIDFILE) == 0)
exit(EXIT_FAILURE);
- atexit(remove_lockfile);
+ atexit(_remove_files_on_exit);
(void) dm_prepare_selinux_context(NULL, 0);
/* Set the rest of the signals to cause '_exit_now' to be set */
+ signal(SIGTERM, &_exit_handler);
signal(SIGINT, &_exit_handler);
signal(SIGHUP, &_exit_handler);
signal(SIGQUIT, &_exit_handler);