reject invalid arguments to pthread_barrierattr_setpshared
authorRich Felker <dalias@aerifal.cx>
Tue, 28 Aug 2018 22:12:17 +0000 (18:12 -0400)
committerRich Felker <dalias@aerifal.cx>
Tue, 28 Aug 2018 22:12:17 +0000 (18:12 -0400)
this is a POSIX requirement.

src/thread/pthread_barrierattr_setpshared.c

index b391461e16d19adb68ba310fee7d091f1f98c765..c2d2929dcf8e975fd8d743800eb78dfc2be4c9db 100644 (file)
@@ -2,6 +2,7 @@
 
 int pthread_barrierattr_setpshared(pthread_barrierattr_t *a, int pshared)
 {
+       if (pshared > 1U) return EINVAL;
        a->__attr = pshared ? INT_MIN : 0;
        return 0;
 }