From e7e5729f46812929e2acbde19d99eea7e7929670 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 22 Oct 2016 15:19:31 +0200 Subject: lib: Fix wrong comparison FLOW_O_RDONLY is 0, so the previous statement would always be false. --- src/lib/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') 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; -- cgit v1.2.3