summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-22 15:19:31 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-22 15:21:47 +0200
commite7e5729f46812929e2acbde19d99eea7e7929670 (patch)
tree405d5e2d35ce4f9d3ab34d0d503e5d7a7bc8d801 /src
parent0adc6f837f5df8ddfa77b0966fdce0524f8a35ae (diff)
downloadouroboros-e7e5729f46812929e2acbde19d99eea7e7929670.tar.gz
ouroboros-e7e5729f46812929e2acbde19d99eea7e7929670.zip
lib: Fix wrong comparison
FLOW_O_RDONLY is 0, so the previous statement would always be false.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 86a5913e..f737b74c 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -699,7 +699,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;
@@ -1257,7 +1257,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;