diff options
author | dimitri staessens <[email protected]> | 2017-04-03 16:40:46 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-04-03 16:40:46 +0200 |
commit | 0f30eaa3d4dd573f9af30a9fd0c5d22bad63c560 (patch) | |
tree | ed204b5d6f653f6ccb3a12a18c53abab0dad7fa9 /src/ipcpd/local | |
parent | 1d4728bcf572c3ebc1632fec9a6751d6644087ce (diff) | |
download | ouroboros-0f30eaa3d4dd573f9af30a9fd0c5d22bad63c560.tar.gz ouroboros-0f30eaa3d4dd573f9af30a9fd0c5d22bad63c560.zip |
ipcpd: Fix some bad locking
Diffstat (limited to 'src/ipcpd/local')
-rw-r--r-- | src/ipcpd/local/main.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 38a901c0..718c8d7e 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -229,6 +229,12 @@ static int ipcp_local_flow_alloc(int fd, assert(dst_name); + out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube); + if (out_fd < 0) { + log_dbg("Flow allocation failed."); + return -1; + } + pthread_rwlock_rdlock(&ipcpi.state_lock); if (ipcp_get_state() != IPCP_OPERATIONAL) { @@ -239,14 +245,6 @@ static int ipcp_local_flow_alloc(int fd, pthread_rwlock_wrlock(&local_data.lock); - out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube); - if (out_fd < 0) { - log_dbg("Flow allocation failed."); - pthread_rwlock_unlock(&local_data.lock); - pthread_rwlock_unlock(&ipcpi.state_lock); - return -1; - } - local_data.in_out[fd] = out_fd; local_data.in_out[out_fd] = fd; |