summaryrefslogtreecommitdiff
path: root/tests/semaphore1.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/semaphore1.c')
-rw-r--r--tests/semaphore1.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/semaphore1.c b/tests/semaphore1.c
index 59e6aee..de349c7 100644
--- a/tests/semaphore1.c
+++ b/tests/semaphore1.c
@@ -119,17 +119,18 @@ main()
{
pthread_t t;
sem_t s;
- int result;
+ void* result1 = (void*)-1;
+ int result2;
assert(pthread_create(&t, NULL, thr, NULL) == 0);
- assert(pthread_join(t, (void *)&result) == 0);
- assert(result == 0);
+ assert(pthread_join(t, (void *)&result1) == 0);
+ assert((int)(size_t)result1 == 0);
assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
- assert((result = sem_trywait(&s)) == -1);
+ assert((result2 = sem_trywait(&s)) == -1);
- if ( result == -1 )
+ if (result2 == -1)
{
int err = errno;
printf("main: sem_trywait 1: expecting error %s: got %s\n",
@@ -141,11 +142,11 @@ main()
printf("main: ok 1\n");
}
- assert((result = sem_post(&s)) == 0);
+ assert((result2 = sem_post(&s)) == 0);
- assert((result = sem_trywait(&s)) == 0);
+ assert((result2 = sem_trywait(&s)) == 0);
- if ( result == -1 )
+ if ( result2 == -1 )
{
perror("main: sem_trywait 2");
}