diff options
author | 2016-09-20 17:04:34 +0000 | |
---|---|---|
committer | 2016-09-20 17:04:34 +0000 | |
commit | f2da64fbbbf1b03f09f390ab01267c93dfd77c4c (patch) | |
tree | fddd521b3d182893400af0a0b9c4ba435c809352 /regress/lib/libpthread/cancel | |
parent | shorten version; (diff) | |
download | wireguard-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')
-rw-r--r-- | regress/lib/libpthread/cancel/Makefile | 4 | ||||
-rw-r--r-- | regress/lib/libpthread/cancel/cancel.c | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/regress/lib/libpthread/cancel/Makefile b/regress/lib/libpthread/cancel/Makefile index de275c5e13a..d2d668be7c3 100644 --- a/regress/lib/libpthread/cancel/Makefile +++ b/regress/lib/libpthread/cancel/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $ +# $OpenBSD: Makefile,v 1.3 2016/09/20 17:04:34 otto Exp $ PROG= cancel - +LDADD= -lutil .include <bsd.regress.mk> 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) { |