summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2023-10-10 18:18:06 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2023-10-10 18:18:06 +0000
commit896a50210592ec1cb0f823607605ced70f8d5627 (patch)
tree083ffc8054c91c1a0fa297bd1095a682a4fa81f2 /regress
parent9ce15ae3c86fb8f8e84f53457ba21015f5128fdd (diff)
Fix timing issue in which one thread could be left hanging in
pipe_read().
Diffstat (limited to 'regress')
-rw-r--r--regress/sys/kern/pipe/test-kqueue.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/regress/sys/kern/pipe/test-kqueue.c b/regress/sys/kern/pipe/test-kqueue.c
index ede5bc96c88..f13015f8be7 100644
--- a/regress/sys/kern/pipe/test-kqueue.c
+++ b/regress/sys/kern/pipe/test-kqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test-kqueue.c,v 1.4 2021/10/22 05:03:57 anton Exp $ */
+/* $OpenBSD: test-kqueue.c,v 1.5 2023/10/10 18:18:05 anton Exp $ */
/*
* Copyright (c) 2019 Anton Lindqvist <anton@openbsd.org>
@@ -137,6 +137,8 @@ test_kqueue_write(void)
n = read(ctx.c_pipe[0], &c, 1);
if (n == -1)
err(1, "read");
+ if (n == 0)
+ break;
if (n != 1)
errx(1, "read: %ld != 1", n);
}
@@ -296,5 +298,7 @@ kqueue_thread(void *arg)
ctx->c_alive = 0;
ctx_unlock(ctx);
+ close(fd);
+
return NULL;
}