about summary refs log tree commit diff
path: root/nptl/sem_post.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2015-05-19 15:04:41 -0700
committerRoland McGrath <roland@hack.frob.com>2015-05-19 15:04:41 -0700
commit88ed594f5d431d855256edbe7e886c8cf4b575dc (patch)
tree32b8ea30f6e6aa95290817dc911978738371c5a2 /nptl/sem_post.c
parent654055e09332a0be9a2f0439dbc052e6a82f448a (diff)
downloadglibc-88ed594f5d431d855256edbe7e886c8cf4b575dc.tar.gz
glibc-88ed594f5d431d855256edbe7e886c8cf4b575dc.tar.xz
glibc-88ed594f5d431d855256edbe7e886c8cf4b575dc.zip
BZ#18434: Fix sem_post EOVERFLOW check for [!__HAVE_64B_ATOMICS].
Diffstat (limited to 'nptl/sem_post.c')
-rw-r--r--nptl/sem_post.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nptl/sem_post.c b/nptl/sem_post.c
index 6e495ed810..b6d30b514f 100644
--- a/nptl/sem_post.c
+++ b/nptl/sem_post.c
@@ -84,14 +84,14 @@ __new_sem_post (sem_t *sem)
   unsigned int v = atomic_load_relaxed (&isem->value);
   do
     {
-      if ((v << SEM_VALUE_SHIFT) == SEM_VALUE_MAX)
+      if ((v >> SEM_VALUE_SHIFT) == SEM_VALUE_MAX)
 	{
 	  __set_errno (EOVERFLOW);
 	  return -1;
 	}
     }
-  while (!atomic_compare_exchange_weak_release (&isem->value,
-      &v, v + (1 << SEM_VALUE_SHIFT)));
+  while (!atomic_compare_exchange_weak_release
+	 (&isem->value, &v, v + (1 << SEM_VALUE_SHIFT)));
 
   /* If there is any potentially blocked waiter, wake one of them.  */
   if ((v & SEM_NWAITERS_MASK) != 0)