summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-07-07 09:50:30 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-07-07 09:50:30 +0200
commit80441117cf61137c6a8c97e0779e70d76ae8541d (patch)
tree01691cd4b34c9a5292f375dd1d12e80335dfeaf8 /src/ipcpd
parentb61b1ce112261f812ff1d6093b89768eeca237b5 (diff)
parent442c2b866e55545a0e21eaaf36b11621c8110411 (diff)
downloadouroboros-80441117cf61137c6a8c97e0779e70d76ae8541d.tar.gz
ouroboros-80441117cf61137c6a8c97e0779e70d76ae8541d.zip
Merged in dstaesse/ouroboros/be-irmd-fix-create (pull request #164)
lib:irmd: Fix logs and irm_create
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/local/main.c15
-rw-r--r--src/ipcpd/shim-eth-llc/main.c12
-rw-r--r--src/ipcpd/shim-udp/main.c15
3 files changed, 28 insertions, 14 deletions
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);
}
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index 5e355bd7..4c260301 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -1247,7 +1247,7 @@ int main(int argc, char * argv[])
if (ipcp_parse_arg(argc, argv)) {
LOG_ERR("Failed to parse arguments.");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* store the process id of the irmd */
@@ -1268,14 +1268,16 @@ int main(int argc, char * argv[])
_ipcp = ipcp_instance_create();
if (_ipcp == NULL) {
LOG_ERR("Failed to create instance.");
- exit(1);
+ close_logfile();
+ exit(EXIT_FAILURE);
}
_ipcp->data = (struct ipcp_data *) eth_llc_ipcp_data_create();
if (_ipcp->data == NULL) {
LOG_ERR("Failed to create instance data.");
free(_ipcp);
- exit(1);
+ close_logfile();
+ exit(EXIT_FAILURE);
}
for (i = 0; i < AP_MAX_FLOWS; i++) {
@@ -1304,5 +1306,7 @@ int main(int argc, char * argv[])
free(_ipcp);
- exit(0);
+ close_logfile();
+
+ exit(EXIT_SUCCESS);
}
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 92204970..ddf4e80e 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -1569,11 +1569,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]);
@@ -1592,8 +1594,9 @@ int main(int argc, char * argv[])
_ipcp = ipcp_udp_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);
@@ -1614,6 +1617,8 @@ int main(int argc, char * argv[])
free(_ipcp->ops);
free(_ipcp);
+ close_logfile();
+
exit(EXIT_SUCCESS);
}