summaryrefslogtreecommitdiffstats
path: root/test/asynctest.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-11-13 11:22:21 +0000
committerMatt Caswell <matt@openssl.org>2015-11-20 23:37:17 +0000
commit2b2c78d4f0a73498739cfc0879299d7325c35160 (patch)
tree2ed0601fe6fa8482bca8646a8cc0b290386e48f4 /test/asynctest.c
parente38565f536b7674ef507564b5c646712b1d7eed4 (diff)
Swap to using proper windows pipes
We were using _pipe to create a pipe on windows. This uses the "int" type for its file descriptor for compatibility. However most windows functions expect to use a "HANDLE". Probably we could get away with just casting but it seems more robust to use the proper type and main stream windows functions. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test/asynctest.c')
-rw-r--r--test/asynctest.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/asynctest.c b/test/asynctest.c
index d89e8ad789..5dd5c4adff 100644
--- a/test/asynctest.c
+++ b/test/asynctest.c
@@ -67,7 +67,7 @@
# if _POSIX_VERSION >= 200112L
# define ASYNC_POSIX
# endif
-#elif (defined(_WIN32) || defined(__CYGWIN__)) && defined(_WINDLL)
+#elif defined(_WIN32) || defined(__CYGWIN__)
# define ASYNC_WIN
#endif
@@ -201,8 +201,9 @@ static int test_ASYNC_get_current_job()
return 1;
}
-static int hasdata(int fd)
+static int hasdata(OSSL_ASYNC_FD fd)
{
+#ifdef ASYNC_POSIX
fd_set checkfds;
struct timeval tv;
FD_ZERO(&checkfds);
@@ -213,12 +214,21 @@ static int hasdata(int fd)
if (FD_ISSET(fd, &checkfds))
return 1;
return 0;
+#else
+ DWORD avail = 0;
+
+ if (PeekNamedPipe(fd, NULL, 0, NULL, &avail, NULL) && avail > 0)
+ return 1;
+
+ return 0;
+#endif
}
static int test_ASYNC_get_wait_fd()
{
ASYNC_JOB *job = NULL;
- int funcret, fd;
+ int funcret;
+ OSSL_ASYNC_FD fd;
if ( !ASYNC_init_pool(1, 0)
|| ASYNC_start_job(&job, &funcret, wake, NULL, 0)