From 442c2b866e55545a0e21eaaf36b11621c8110411 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 7 Jul 2016 09:31:49 +0200 Subject: 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). --- src/irmd/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/irmd') 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); -- cgit v1.2.3