aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2018-09-20 12:42:07 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2018-09-20 12:42:07 +0200
commitb9a8307815f0452a84c06cae0e6324b41703f843 (patch)
treeb62b56a533a0dba127e010be53ddc1736b2e86fc
parenteade84bcf34d681a5897c4198eaf7175d74ebf93 (diff)
downloadlibrb-b9a8307815f0452a84c06cae0e6324b41703f843.tar.gz
librb-b9a8307815f0452a84c06cae0e6324b41703f843.tar.bz2
librb-b9a8307815f0452a84c06cae0e6324b41703f843.zip
change O_WRONLY to O_RDWR only on openbsd system
-rw-r--r--tests.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests.c b/tests.c
index 84a3e82..d6c0604 100644
--- a/tests.c
+++ b/tests.c
@@ -177,7 +177,11 @@ static void *multi_pipe_producer(void *arg)
unsigned int index;
int fd;
+#if defined(__OpenBSD__)
fd = open(d->pipe, O_RDWR);
+#else
+ fd = open(d->pipe, O_WRONLY);
+#endif
for (;;)
{
@@ -251,7 +255,11 @@ static void *multi_pipe_consumer(void *arg)
unsigned int index;
int fd;
+#if defined(__OpenBSD__)
fd = open(d->pipe, O_RDWR);
+#else
+ fd = open(d->pipe, O_RDONLY);
+#endif
for (;;)
{
@@ -449,7 +457,11 @@ static void multi_file_consumer_producer(void)
pthread_create(prod, NULL, multi_producer, &prod_data);
cons_data.rb = rb;
+#if defined(__OpenBSD__)
cons_data.fd = open("./rb-test-fifo", O_RDWR);
+#else
+ cons_data.fd = open("./rb-test-fifo", O_WRONLY);
+#endif
for (i = 0; i != t_num_consumers; ++i)
{
pthread_create(&cons[i], NULL, multi_consumer, &cons_data);
@@ -468,7 +480,11 @@ static void multi_file_consumer_producer(void)
pthread_create(cons, NULL, multi_consumer, &cons_data);
prod_data.rb = rb;
+#if defined(__OpenBSD__)
prod_data.fd = open("./rb-test-fifo", O_RDWR);
+#else
+ prod_data.fd = open("./rb-test-fifo", O_RDONLY);
+#endif
for (i = 0; i != t_num_producers; ++i)
{
pthread_create(&prod[i], NULL, multi_producer, &prod_data);