summaryrefslogtreecommitdiff
path: root/libc/nptl/tst-sem13.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/nptl/tst-sem13.c')
-rw-r--r--libc/nptl/tst-sem13.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/libc/nptl/tst-sem13.c b/libc/nptl/tst-sem13.c
index 8756b2262..068d79e85 100644
--- a/libc/nptl/tst-sem13.c
+++ b/libc/nptl/tst-sem13.c
@@ -30,12 +30,31 @@ do_test (void)
}
if (errno != EINVAL)
{
- puts ("sem_timedwait did not fail with EINVAL");
+ perror ("sem_timedwait did not fail with EINVAL");
return 1;
}
if (u.ns.nwaiters != 0)
{
- puts ("nwaiters modified");
+ printf ("sem_timedwait modified nwaiters: %ld\n", u.ns.nwaiters);
+ return 1;
+ }
+
+ ts.tv_sec = /* Invalid. */ -2;
+ ts.tv_nsec = 0;
+ errno = 0;
+ if (sem_timedwait (&u.s, &ts) >= 0)
+ {
+ puts ("2nd sem_timedwait did not fail");
+ return 1;
+ }
+ if (errno != ETIMEDOUT)
+ {
+ perror ("2nd sem_timedwait did not fail with ETIMEDOUT");
+ return 1;
+ }
+ if (u.ns.nwaiters != 0)
+ {
+ printf ("2nd sem_timedwait modified nwaiters: %ld\n", u.ns.nwaiters);
return 1;
}