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/ipcpd/local/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ipcpd/local') diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index ffe69dfb..ae75ae5e 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -585,11 +585,13 @@ int main(int argc, char * argv[]) if (ipcp_parse_arg(argc, argv)) { LOG_ERR("Failed to parse arguments."); - exit(1); + exit(EXIT_FAILURE); } - if (shim_ap_init() < 0) - exit(1); + if (shim_ap_init() < 0) { + close_logfile(); + exit(EXIT_FAILURE); + } /* store the process id of the irmd */ irmd_api = atoi(argv[1]); @@ -608,8 +610,9 @@ int main(int argc, char * argv[]) _ipcp = ipcp_local_create(); if (_ipcp == NULL) { - LOG_ERR("Won't."); - exit(1); + LOG_ERR("Failed to create IPCP."); + close_logfile(); + exit(EXIT_FAILURE); } pthread_rwlock_wrlock(&_ipcp->state_lock); @@ -630,6 +633,8 @@ int main(int argc, char * argv[]) free(_ipcp->ops); free(_ipcp); + close_logfile(); + exit(EXIT_SUCCESS); } -- cgit v1.2.3