summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-22 20:45:41 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-22 20:45:41 +0200
commit9544da4a44f40f8c90b56b816a28fc6ac566d85d (patch)
tree37ebb2d5c4d5a266f6e298fc7960aa609c07bc0e /src/irmd/main.c
parent467e504993c1cb0351dc3e279e7aeab8e5df333f (diff)
downloadouroboros-9544da4a44f40f8c90b56b816a28fc6ac566d85d.tar.gz
ouroboros-9544da4a44f40f8c90b56b816a28fc6ac566d85d.zip
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.
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c9
1 files 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) {