diff options
author | dimitri staessens <[email protected]> | 2016-10-22 15:19:31 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-10-22 15:21:47 +0200 |
commit | e7e5729f46812929e2acbde19d99eea7e7929670 (patch) | |
tree | 405d5e2d35ce4f9d3ab34d0d503e5d7a7bc8d801 /src/lib | |
parent | 0adc6f837f5df8ddfa77b0966fdce0524f8a35ae (diff) | |
download | ouroboros-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/lib')
-rw-r--r-- | src/lib/dev.c | 4 |
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; |