about summary refs log tree commit diff
path: root/nptl/pthread_condattr_setpshared.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-03 02:58:30 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-03 02:58:30 +0000
commite29ef6470637f570919916670ed4d23d5861969e (patch)
tree0490afd97cd62e6ab3f8c8f4e93d006d62c51fcb /nptl/pthread_condattr_setpshared.c
parent763d0f40cf4eb7861a1e4190c5bb5394334eb26a (diff)
downloadglibc-e29ef6470637f570919916670ed4d23d5861969e.tar.gz
glibc-e29ef6470637f570919916670ed4d23d5861969e.tar.xz
glibc-e29ef6470637f570919916670ed4d23d5861969e.zip
Update.
2003-09-02  Jakub Jelinek  <jakub@redhat.com>

	* barrier.c (__pthread_barrierattr_getpshared): Always
	return PTHREAD_PROCESS_PRIVATE.
	(pthread_barrierattr_setpshared): Return EINVAL if pshared
	is neither PTHREAD_PROCESS_PRIVATE nor PTHREAD_PROCESS_SHARED.
Diffstat (limited to 'nptl/pthread_condattr_setpshared.c')
-rw-r--r--nptl/pthread_condattr_setpshared.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nptl/pthread_condattr_setpshared.c b/nptl/pthread_condattr_setpshared.c
index f47afccef0..f00858780b 100644
--- a/nptl/pthread_condattr_setpshared.c
+++ b/nptl/pthread_condattr_setpshared.c
@@ -17,16 +17,21 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "pthreadP.h"
+#include <errno.h>
+#include <pthreadP.h>
 
 int
 pthread_condattr_setpshared (attr, pshared)
      pthread_condattr_t *attr;
      int pshared;
 {
+  if (pshared != PTHREAD_PROCESS_PRIVATE
+      && __builtin_expect (pshared != PTHREAD_PROCESS_SHARED, 0))
+    return EINVAL;
+
   int *valuep = &((struct pthread_condattr *) attr)->value;
 
-  *valuep = (*valuep & ~1) | (pshared != 0);
+  *valuep = (*valuep & ~1) | (pshared != PTHREAD_PROCESS_PRIVATE);
 
   return 0;
 }