summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2004-01-08 04:19:19 +0000
committermarc <marc@openbsd.org>2004-01-08 04:19:19 +0000
commit118edbbea7b4818f5651ef80cc9c3b57fedac034 (patch)
treef577eacae17fe4df1da72b65410622817856ed51
parentuse va_copy() with gcc 3 and up. (diff)
downloadwireguard-openbsd-118edbbea7b4818f5651ef80cc9c3b57fedac034.tar.xz
wireguard-openbsd-118edbbea7b4818f5651ef80cc9c3b57fedac034.zip
Update regression test to match current library semantics. A select
is supposed to fail with EBADF if another thread closes the fd/socket that is being selected.
-rw-r--r--regress/lib/libpthread/close/close.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/regress/lib/libpthread/close/close.c b/regress/lib/libpthread/close/close.c
index 1ef4bf70091..ed218f153f8 100644
--- a/regress/lib/libpthread/close/close.c
+++ b/regress/lib/libpthread/close/close.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: close.c,v 1.4 2003/07/31 21:48:04 deraadt Exp $ */
+/* $OpenBSD: close.c,v 1.5 2004/01/08 04:19:19 marc Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
* proven@mit.edu All rights reserved.
@@ -107,8 +107,10 @@ new_thread(void* arg)
printf("child: writing some garbage to fd %d\n", fd);
CHECKe(write(fd, garbage, sizeof garbage));
printf("child: calling select() with fd %d\n", fd);
- CHECKe(ret = select(fd + 1, &r, NULL, NULL, NULL));
- printf("child: select() returned %d\n", ret);
+ ASSERT((ret = select(fd + 1, &r, NULL, NULL, NULL)) == -1);
+ ASSERT(errno == EBADF);
+ printf("child: select() returned %d, errno %d = %s [correct]\n", ret,
+ errno, strerror(errno));
return NULL;
}