aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2018-02-01 08:12:49 +0100
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2018-02-01 08:12:49 +0100
commite66d7bac550bbf3be263132a1fa4dfd568ab885f (patch)
tree122bf7e177ce91e051ea6e139f28a0aa972b0e95
parente5ebd7911e3f6aebc780fbb75bfe478eae663b67 (diff)
downloadlibrb-e66d7bac550bbf3be263132a1fa4dfd568ab885f.tar.gz
librb-e66d7bac550bbf3be263132a1fa4dfd568ab885f.tar.bz2
librb-e66d7bac550bbf3be263132a1fa4dfd568ab885f.zip
fix: idiotic checks to see if flags are set
-rw-r--r--rb/rb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/rb/rb.c b/rb/rb.c
index 4a81bdc..c885fe8 100644
--- a/rb/rb.c
+++ b/rb/rb.c
@@ -613,7 +613,7 @@ struct rb *rb_new
* without threads
*/
- VALID(ENOSYS, flags & O_MULTIHREAD);
+ VALIDR(ENOSYS, NULL, (flags & O_MULTITHREAD) == 0);
#endif
if (rb_is_power_of_two(count) == 0)
@@ -644,11 +644,7 @@ struct rb *rb_new
#if ENABLE_THREADS == 0
return rb;
#else
- /*
- * Multithreaded environment
- */
-
- if (flags & ~O_MULTITHREAD)
+ if ((flags & O_MULTITHREAD) == 0)
{
/*
* when working in non multi-threaded mode, force O_NONBLOCK flag,
@@ -659,6 +655,10 @@ struct rb *rb_new
return rb;
}
+ /*
+ * Multithreaded environment
+ */
+
rb->stopped_all = -1;
rb->force_exit = 0;
@@ -882,7 +882,7 @@ int rb_destroy
VALID(EINVAL, rb->buffer);
#if ENABLE_THREADS
- if (rb->flags & ~O_MULTITHREAD)
+ if ((rb->flags & O_MULTITHREAD) == 0)
{
free(rb->buffer);
free(rb);