summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-25 10:13:22 +0000
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-25 10:13:22 +0000
commitcfc1e421cd222f41dd1c8498d631a31c680e4211 (patch)
tree865c3a4ddaae033d499f4dfb96d55db602694751 /src/lib/dev.c
parent317821ca093f7c22e0bf1a9bb15e17c3c501e498 (diff)
parentbd293f2cdb57ea966d86219d6f661194482a2705 (diff)
downloadouroboros-cfc1e421cd222f41dd1c8498d631a31c680e4211.tar.gz
ouroboros-cfc1e421cd222f41dd1c8498d631a31c680e4211.zip
Merged in dstaesse/ouroboros/be-fix (pull request #351)
lib: Fix reading non-blocking flows
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index c62fea40..eefb9b18 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -919,13 +919,12 @@ ssize_t flow_read(int fd, void * buf, size_t count)
pthread_rwlock_rdlock(&ai.data_lock);
}
- if (idx == -ETIMEDOUT) {
+ if (idx < 0) {
+ assert(idx == -EAGAIN || idx == -ETIMEDOUT);
pthread_rwlock_unlock(&ai.data_lock);
- return -ETIMEDOUT;
+ return idx;
}
- assert(idx >= 0);
-
n = shm_rdrbuff_read(&sdu, ai.rdrb, idx);
if (n < 0) {
pthread_rwlock_unlock(&ai.data_lock);