summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-10-23 07:54:29 +0000
committerSander Vrijders <[email protected]>2016-10-23 07:54:29 +0000
commit2a270c017e51f041997da666c1d9bea2ab189380 (patch)
tree9eda13e1fbe9a74836679f7b26d889a4e5448b2a /src/lib/dev.c
parentcf97ff1b1971a676d04b6f0a16bb3c5bb53c933c (diff)
parent4bb18901fa222dc686886e7736e9935cfa1a4672 (diff)
downloadouroboros-2a270c017e51f041997da666c1d9bea2ab189380.tar.gz
ouroboros-2a270c017e51f041997da666c1d9bea2ab189380.zip
Merged in dstaesse/ouroboros/be-fix-build (pull request #270)
Some fixes
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 86a5913e..cac3ca37 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -276,7 +276,6 @@ void ap_fini()
bmp_destroy(ai.fds);
bmp_destroy(ai.fqueues);
shm_flow_set_destroy(ai.fqset);
- shm_rdrbuff_close(ai.rdrb);
if (ai.daf_name != NULL)
free(ai.daf_name);
@@ -303,6 +302,8 @@ void ap_fini()
pthread_cond_destroy(&ai.ports[i].state_cond);
}
+ shm_rdrbuff_close(ai.rdrb);
+
free(ai.flows);
free(ai.ports);
@@ -699,7 +700,7 @@ ssize_t flow_write(int fd, void * buf, size_t count)
return -ENOTALLOC;
}
- if (ai.flows[fd].oflags & FLOW_O_RDONLY) {
+ if ((ai.flows[fd].oflags & FLOW_O_ACCMODE) == FLOW_O_RDONLY) {
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
return -EPERM;
@@ -960,12 +961,13 @@ int flow_event_wait(struct flow_set * set,
if (fq->fqsize > 0)
return 0;
+ assert(!fq->next);
+
ret = shm_flow_set_wait(ai.fqset, set->idx, fq->fqueue, timeout);
if (ret == -ETIMEDOUT)
return -ETIMEDOUT;
fq->fqsize = ret;
- fq->next = 0;
return 0;
}
@@ -1257,7 +1259,7 @@ int ipcp_flow_write(int fd, struct shm_du_buff * sdb)
pthread_rwlock_rdlock(&ai.data_lock);
pthread_rwlock_rdlock(&ai.flows_lock);
- if (ai.flows[fd].oflags & FLOW_O_RDONLY) {
+ if ((ai.flows[fd].oflags & FLOW_O_ACCMODE) == FLOW_O_RDONLY) {
pthread_rwlock_unlock(&ai.flows_lock);
pthread_rwlock_unlock(&ai.data_lock);
return -EPERM;