summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-07 09:31:49 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-07 09:40:42 +0200
commit442c2b866e55545a0e21eaaf36b11621c8110411 (patch)
treec86c744f50ae4c091d79991f48769e41eadda1bf /src/irmd/main.c
parent6f8024ef27933d0123aee3d02002ca3600270e72 (diff)
downloadouroboros-442c2b866e55545a0e21eaaf36b11621c8110411.tar.gz
ouroboros-442c2b866e55545a0e21eaaf36b11621c8110411.zip
irmd, ipcps: Close logfile on exit
IRMd and ipcps will now close the logfile upon exit. Also corrects exit(1) to exit(EXIT_FAILURE) and exit(0) to exit(EXIT_SUCCESS).
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 62673251..1f72fa1a 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1704,7 +1704,7 @@ static struct irm * irm_create()
if (dum == NULL) {
LOG_ERR("Could not examine existing shm file.");
free(instance);
- exit(EXIT_FAILURE);
+ return NULL;
}
if (kill(shm_du_map_owner(dum), 0) < 0) {
@@ -1716,7 +1716,7 @@ static struct irm * irm_create()
shm_du_map_owner(dum));
shm_du_map_close(dum);
free(instance);
- exit(EXIT_SUCCESS);
+ return NULL;
}
shm_du_map_close(dum);
@@ -1879,8 +1879,10 @@ int main(int argc, char ** argv)
exit(EXIT_FAILURE);
instance = irm_create();
- if (instance == NULL)
+ if (instance == NULL) {
+ close_logfile();
exit(EXIT_FAILURE);
+ }
for (t = 0; t < IRMD_THREADPOOL_SIZE; ++t)
pthread_create(&instance->threadpool[t], NULL, mainloop, NULL);