summaryrefslogtreecommitdiffstats
path: root/regress/lib/libpthread/cancel/cancel.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2016-09-20 17:04:34 +0000
committerotto <otto@openbsd.org>2016-09-20 17:04:34 +0000
commitf2da64fbbbf1b03f09f390ab01267c93dfd77c4c (patch)
treefddd521b3d182893400af0a0b9c4ba435c809352 /regress/lib/libpthread/cancel/cancel.c
parentshorten version; (diff)
downloadwireguard-openbsd-f2da64fbbbf1b03f09f390ab01267c93dfd77c4c.tar.xz
wireguard-openbsd-f2da64fbbbf1b03f09f390ab01267c93dfd77c4c.zip
don't depend on /dev/tty, in bluhm's framework there is no such thing
use openpty(3) instead
Diffstat (limited to 'regress/lib/libpthread/cancel/cancel.c')
-rw-r--r--regress/lib/libpthread/cancel/cancel.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/regress/lib/libpthread/cancel/cancel.c b/regress/lib/libpthread/cancel/cancel.c
index 9ff11818c9e..cd68116b285 100644
--- a/regress/lib/libpthread/cancel/cancel.c
+++ b/regress/lib/libpthread/cancel/cancel.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: cancel.c,v 1.7 2013/10/06 21:46:10 guenther Exp $ */
+/* $OpenBSD: cancel.c,v 1.8 2016/09/20 17:04:34 otto Exp $ */
/* David Leonard <d@openbsd.org>, 1999. Public Domain. */
#include <pthread.h>
#include <pthread_np.h>
#include <unistd.h>
+#include <util.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -49,14 +50,14 @@ c1handler(void *arg)
static void *
child1fn(void *arg)
{
- int fd;
+ int fd, dummy;
char buf[1024];
int len;
SET_NAME("c1");
CHECKr(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL));
/* something that will block */
- CHECKe(fd = open("/dev/tty", O_RDONLY));
+ CHECKe(openpty(&fd, &dummy, NULL, NULL, NULL));
pthread_cleanup_push(c1handler, (void *)&fd);
v();
while (1) {