about summary refs log tree commit diff
path: root/nptl/tst-sem13.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-03-08 09:33:12 +0100
committerThomas Schwinge <thomas@codesourcery.com>2012-03-08 09:33:12 +0100
commit48aff7765b16851c4c3c5b7beb44c878d0d24ae8 (patch)
tree5526b4e91f2306ee1eaa14ac67c52267bc49f9f5 /nptl/tst-sem13.c
parentaea5d7277a2ebd2f432bc3196e4a0e2afe8d5878 (diff)
downloadglibc-48aff7765b16851c4c3c5b7beb44c878d0d24ae8.tar.gz
glibc-48aff7765b16851c4c3c5b7beb44c878d0d24ae8.tar.xz
glibc-48aff7765b16851c4c3c5b7beb44c878d0d24ae8.zip
Fix 9554ebf2d4da22591e974d3cf2ed09a2b8dbdbd8.
| Invalid timeouts in i386 sem_timedwait.
|
| We adjusted nwaiters even though this isn't necessary.
Diffstat (limited to 'nptl/tst-sem13.c')
-rw-r--r--nptl/tst-sem13.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/nptl/tst-sem13.c b/nptl/tst-sem13.c
index 8756b2262f..068d79e85e 100644
--- a/nptl/tst-sem13.c
+++ b/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;
     }