summaryrefslogtreecommitdiff
path: root/tests/semaphore1.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/semaphore1.c')
-rw-r--r--tests/semaphore1.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/tests/semaphore1.c b/tests/semaphore1.c
index 0f2eb77..8fc91ee 100644
--- a/tests/semaphore1.c
+++ b/tests/semaphore1.c
@@ -86,8 +86,11 @@ thr(void * arg)
if ( result == -1 )
{
int err = errno;
- printf("thread: sem_trywait 1: expecting error %s: got %s\n",
- error_string[EAGAIN], error_string[err]); fflush(stdout);
+ if (err != EAGAIN)
+ {
+ printf("thread: sem_trywait 1: expecting error %s: got %s\n",
+ error_string[EAGAIN], error_string[err]); fflush(stdout);
+ }
assert(err == EAGAIN);
}
else
@@ -99,15 +102,6 @@ thr(void * arg)
assert((result = sem_trywait(&s)) == 0);
- if ( result == -1 )
- {
- perror("thread: sem_trywait 2");
- }
- else
- {
- printf("thread: ok 2\n");
- }
-
assert(sem_post(&s) == 0);
return NULL;
@@ -133,8 +127,11 @@ main()
if (result2 == -1)
{
int err = errno;
- printf("main: sem_trywait 1: expecting error %s: got %s\n",
- error_string[EAGAIN], error_string[err]); fflush(stdout);
+ if (err != EAGAIN)
+ {
+ printf("main: sem_trywait 1: expecting error %s: got %s\n",
+ error_string[EAGAIN], error_string[err]); fflush(stdout);
+ }
assert(err == EAGAIN);
}
else
@@ -146,15 +143,6 @@ main()
assert((result2 = sem_trywait(&s)) == 0);
- if ( result2 == -1 )
- {
- perror("main: sem_trywait 2");
- }
- else
- {
- printf("main: ok 2\n");
- }
-
assert(sem_post(&s) == 0);
return 0;