Browse Source

reject invalid attribute settings

note that this is a pedantic conformance issue and waste of code. it
only affects broken code or code that is probing for conformance.
Rich Felker 14 years ago
parent
commit
63b06c0e90
2 changed files with 2 additions and 0 deletions
  1. 1 0
      src/thread/pthread_attr_setdetachstate.c
  2. 1 0
      src/thread/pthread_attr_setscope.c

+ 1 - 0
src/thread/pthread_attr_setdetachstate.c

@@ -2,6 +2,7 @@
 
 int pthread_attr_setdetachstate(pthread_attr_t *a, int state)
 {
+	if (state > 1U) return EINVAL;
 	a->_a_detach = state;
 	return 0;
 }

+ 1 - 0
src/thread/pthread_attr_setscope.c

@@ -2,5 +2,6 @@
 
 int pthread_attr_setscope(pthread_attr_t *a, int scope)
 {
+	if (scope > 1U) return EINVAL;
 	return 0;
 }