reject invalid attribute settings
authorRich Felker <dalias@aerifal.cx>
Mon, 7 Mar 2011 20:46:37 +0000 (15:46 -0500)
committerRich Felker <dalias@aerifal.cx>
Mon, 7 Mar 2011 20:46:37 +0000 (15:46 -0500)
note that this is a pedantic conformance issue and waste of code. it
only affects broken code or code that is probing for conformance.

src/thread/pthread_attr_setdetachstate.c
src/thread/pthread_attr_setscope.c

index bfffba8..1b71278 100644 (file)
@@ -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;
 }
index a970a81..d56ee39 100644 (file)
@@ -2,5 +2,6 @@
 
 int pthread_attr_setscope(pthread_attr_t *a, int scope)
 {
+       if (scope > 1U) return EINVAL;
        return 0;
 }