about summary refs log tree commit diff
path: root/nptl/pthread_mutex_getprioceiling.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-14 23:11:18 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-14 23:11:18 +0000
commitf17efcb43e500d4af62b71bd6f286af831069b5a (patch)
treebf062a11f158b5bc8e33e42cc85e625751bacf94 /nptl/pthread_mutex_getprioceiling.c
parent107b8a922a9f72bae8d066549c675062bee0897f (diff)
downloadglibc-f17efcb43e500d4af62b71bd6f286af831069b5a.tar.gz
glibc-f17efcb43e500d4af62b71bd6f286af831069b5a.tar.xz
glibc-f17efcb43e500d4af62b71bd6f286af831069b5a.zip
* sysdeps/powerpc/powerpc32/dl-trampoline.S (_dl_runtime_resolve):
	Don't clobber caller's LRSAVE.
	(_dl_prof_resolve): Likewise.
Diffstat (limited to 'nptl/pthread_mutex_getprioceiling.c')
-rw-r--r--nptl/pthread_mutex_getprioceiling.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/nptl/pthread_mutex_getprioceiling.c b/nptl/pthread_mutex_getprioceiling.c
index 4d1bc28431..1ce5eaebef 100644
--- a/nptl/pthread_mutex_getprioceiling.c
+++ b/nptl/pthread_mutex_getprioceiling.c
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <pthreadP.h>
 
 
@@ -26,7 +27,11 @@ pthread_mutex_getprioceiling (mutex, prioceiling)
      const pthread_mutex_t *mutex;
      int *prioceiling;
 {
-  *prioceiling = (mutex->__data.__kind & PTHREAD_MUTEX_PRIO_CEILING_MASK)
+  if (__builtin_expect ((mutex->__data.__kind
+			 & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0, 0))
+    return EINVAL;
+
+  *prioceiling = (mutex->__data.__lock & PTHREAD_MUTEX_PRIO_CEILING_MASK)
 		 >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
 
   return 0;