summaryrefslogtreecommitdiff
path: root/regress/lib/libpthread/blocked_close/blocked_close.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/lib/libpthread/blocked_close/blocked_close.c')
-rw-r--r--regress/lib/libpthread/blocked_close/blocked_close.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/regress/lib/libpthread/blocked_close/blocked_close.c b/regress/lib/libpthread/blocked_close/blocked_close.c
index d439aa5b03a..5ad339ba311 100644
--- a/regress/lib/libpthread/blocked_close/blocked_close.c
+++ b/regress/lib/libpthread/blocked_close/blocked_close.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: blocked_close.c,v 1.1 2006/09/22 18:29:47 kurt Exp $ */
+/* $OpenBSD: blocked_close.c,v 1.2 2006/10/06 13:11:58 kurt Exp $ */
/*
* Copyright (c) 2006 Kurt Miller <kurt@intricatesoftware.com>
*
@@ -44,7 +44,7 @@ deadlock_detector(void *arg)
static void *
waiting_read(void *arg)
{
- int fd = (int)arg;
+ int fd = *(int *)arg;
struct sockaddr remote_addr;
char readBuf;
int n, remote_addr_len = sizeof(struct sockaddr);
@@ -52,20 +52,20 @@ waiting_read(void *arg)
n = recvfrom(fd, &readBuf, 1, 0, &remote_addr, &remote_addr_len);
if (n == -1)
- return ((void *)errno);
+ return ((caddr_t)NULL + errno);
else
- return (0);
+ return (NULL);
}
static void *
busy_thread(void *arg)
{
- int fd = (int)arg;
+ int fd = *(int *)arg;
/* loop until error */
while(fcntl(fd, F_GETFD, NULL) != -1);
- return ((void *)errno);
+ return ((caddr_t)NULL + errno);
}
int
@@ -95,10 +95,10 @@ main(int argc, char *argv[])
CHECKr(bind(fd, (struct sockaddr *)&addr, sizeof(addr)));
for (j = 0; j < BUSY_THREADS; j++)
CHECKr(pthread_create(&busy_threads[j], NULL,
- busy_thread, (void *)fd));
+ busy_thread, (void *)&fd));
for (j = 0; j < WAITING_THREADS; j++)
CHECKr(pthread_create(&waiting_threads[j], NULL,
- waiting_read, (void *)fd));
+ waiting_read, (void *)&fd));
nanosleep(&rqtp, NULL);
CHECKr(close(fd));
for (j = 0; j < BUSY_THREADS; j++) {