From 9544da4a44f40f8c90b56b816a28fc6ac566d85d Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sun, 22 May 2016 20:45:41 +0200 Subject: irmd: use the shm_du_map as a uniqueness check This makes sure only one shm_du_map is running in the system. Starting a second irmd would invalidate the shared memory map. --- src/irmd/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/irmd/main.c b/src/irmd/main.c index a33fae84..b84c3327 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1487,8 +1487,13 @@ static struct irm * irm_create() if (i == NULL) return NULL; - if (access("/dev/shm/" SHM_DU_MAP_FILENAME, F_OK) != -1) - unlink("/dev/shm/" SHM_DU_MAP_FILENAME); + if (access("/dev/shm/" SHM_DU_MAP_FILENAME, F_OK) != -1) { + LOG_ERR("IRM daemon is running in this system."); + LOG_ERR("If you think this message is in error,"); + LOG_ERR("please remove /dev/shm/" SHM_DU_MAP_FILENAME); + LOG_ERR("(root privileges required) or reboot your system."); + return NULL; + } i->threadpool = malloc(sizeof(pthread_t) * IRMD_THREADPOOL_SIZE); if (i->threadpool == NULL) { -- cgit v1.2.3