summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2018-10-19 10:16:53 +0200
committerSander Vrijders <[email protected]>2018-10-19 10:20:15 +0200
commit22e46ab72ff1093882b502a095f36a15807a78d9 (patch)
tree68caedc4d6b7c674f3b9992c194e6256282c019c /src
parent40102206f2406c686bb2253b96950084b9a4e6b9 (diff)
downloadouroboros-22e46ab72ff1093882b502a095f36a15807a78d9.tar.gz
ouroboros-22e46ab72ff1093882b502a095f36a15807a78d9.zip
ipcpd: Check flow id instead of assert
This will check if the flow id is valid instead of asserting. It avoids assertion failures in the IPCP if an application crashes and the IRMd deallocates the flow while the IPCP still has pending writes. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/lib/dev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 6dbb925e..3c1494ee 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -1403,7 +1403,10 @@ int ipcp_flow_write(int fd,
pthread_rwlock_rdlock(&ai.lock);
- assert(flow->flow_id >= 0);
+ if (flow->flow_id < 0) {
+ pthread_rwlock_unlock(&ai.lock);
+ return -ENOTALLOC;
+ }
if ((flow->oflags & FLOWFACCMODE) == FLOWFRDONLY) {
pthread_rwlock_unlock(&ai.lock);