summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-09 08:03:44 +0000
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-09 08:03:44 +0000
commit275dc65b22e39654e4dfc9cbd13277e490c8dccd (patch)
tree1ccf39e67ff900147bf05ac40d0bd2542a29b970 /src
parent7403be0eadcc772cd3a44615f34bff0ce7009f86 (diff)
parent62557fd2a0cf5c749a8262949200019f4bbe8763 (diff)
downloadouroboros-275dc65b22e39654e4dfc9cbd13277e490c8dccd.tar.gz
ouroboros-275dc65b22e39654e4dfc9cbd13277e490c8dccd.zip
Merged in dstaesse/ouroboros/be-fixes (pull request #366)
Be fixes
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/gam.c5
-rw-r--r--src/ipcpd/normal/main.c14
2 files changed, 14 insertions, 5 deletions
diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c
index fae34dfe..36025f85 100644
--- a/src/ipcpd/normal/gam.c
+++ b/src/ipcpd/normal/gam.c
@@ -283,6 +283,9 @@ int gam_flow_wait(struct gam * instance,
pthread_mutex_lock(&instance->gas_lock);
+ pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock,
+ (void *) &instance->gas_lock);
+
while (list_is_empty(&instance->gas))
pthread_cond_wait(&instance->gas_cond, &instance->gas_lock);
@@ -299,7 +302,7 @@ int gam_flow_wait(struct gam * instance,
list_del(&ga->next);
free(ga);
- pthread_mutex_unlock(&instance->gas_lock);
+ pthread_cleanup_pop(true);
return 0;
}
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 5d8af688..2b30dba3 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -457,18 +457,20 @@ int main(int argc,
sigaction(SIGHUP, &sig_act, NULL);
sigaction(SIGPIPE, &sig_act, NULL);
- if (irm_bind_api(getpid(), ipcpi.name)) {
- log_err("Failed to bind AP name.");
+ if (ipcp_init(argc, argv, THIS_TYPE, &normal_ops) < 0) {
+ log_err("Failed to create instance.");
exit(EXIT_FAILURE);
}
- if (ipcp_init(argc, argv, THIS_TYPE, &normal_ops) < 0) {
- log_err("Failed to create instance.");
+ if (irm_bind_api(getpid(), ipcpi.name)) {
+ log_err("Failed to bind AP name.");
+ ipcp_fini();
exit(EXIT_FAILURE);
}
if (rib_init()) {
log_err("Failed to initialize RIB.");
+ irm_unbind_api(getpid(), ipcpi.name);
ipcp_fini();
exit(EXIT_FAILURE);
}
@@ -478,6 +480,7 @@ int main(int argc,
if (ipcp_boot() < 0) {
log_err("Failed to boot IPCP.");
rib_fini();
+ irm_unbind_api(getpid(), ipcpi.name);
ipcp_fini();
exit(EXIT_FAILURE);
}
@@ -489,6 +492,7 @@ int main(int argc,
ipcp_set_state(IPCP_NULL);
ipcp_shutdown();
rib_fini();
+ irm_unbind_api(getpid(), ipcpi.name);
ipcp_fini();
exit(EXIT_FAILURE);
}
@@ -500,6 +504,8 @@ int main(int argc,
rib_fini();
+ irm_unbind_api(getpid(), ipcpi.name);
+
ipcp_fini();
exit(EXIT_SUCCESS);