summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-06-16 12:52:52 +0200
committerSander Vrijders <[email protected]>2016-06-16 12:52:52 +0200
commit4aa4e30c5b4f89da1bab5022424c55f5d8b3f580 (patch)
tree75158ce721b25b838b129faedb5490590a2392cb
parent18318ecbd33544438f7ec870437ff93f6d286c07 (diff)
parente7d7632549947fa867d6bec504442647862ad9b8 (diff)
downloadouroboros-4aa4e30c5b4f89da1bab5022424c55f5d8b3f580.tar.gz
ouroboros-4aa4e30c5b4f89da1bab5022424c55f5d8b3f580.zip
Merged in dstaesse/ouroboros/be-graceful-fail-dev (pull request #126)
ipcpd: fixed locking and cleanup
-rw-r--r--src/ipcpd/local/main.c5
-rw-r--r--src/ipcpd/shim-udp/main.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 6357487f..43ca14da 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -365,8 +365,10 @@ static int ipcp_local_flow_alloc(pid_t n_pid,
}
rb = shm_ap_rbuff_open(n_pid);
- if (rb == NULL)
+ if (rb == NULL) {
+ rw_lock_unlock(&_ipcp->state_lock);
return -1; /* -ENORBUFF */
+ }
rw_lock_wrlock(&_ap_instance->flows_lock);
@@ -389,6 +391,7 @@ static int ipcp_local_flow_alloc(pid_t n_pid,
src_ae_name);
if (port_id < 0) {
+ rw_lock_unlock(&_ap_instance->flows_lock);
rw_lock_unlock(&_ipcp->state_lock);
LOG_ERR("Could not get port id from IRMd");
/* shm_ap_rbuff_close(n_pid); */
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 99fb134d..f583a998 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -486,6 +486,7 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr,
src_ae_name);
if (port_id < 0) {
+ rw_lock_unlock(&_ap_instance->flows_lock);
rw_lock_unlock(&_ipcp->state_lock);
LOG_ERR("Could not get port id from IRMd");
close(fd);