X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_setcancelstate.c;h=aa0ddcdd316341ec0ab7a685e2e84a5a8a2b149b;hp=a85cc800f7c64f8736133c2fad6ec6bff3ee791f;hb=9beb6330c08839e8bb2ebcd129c97c395d9d327e;hpb=19c1830eaaab05652d87b5ee9557d0d7a40c2f06 diff --git a/src/thread/pthread_setcancelstate.c b/src/thread/pthread_setcancelstate.c index a85cc800..aa0ddcdd 100644 --- a/src/thread/pthread_setcancelstate.c +++ b/src/thread/pthread_setcancelstate.c @@ -3,8 +3,8 @@ int pthread_setcancelstate(int new, int *old) { struct pthread *self = pthread_self(); - if (old) *old = self->canceldisable & 1; - if ((unsigned)new > 1) return EINVAL; - self->canceldisable = (self->canceldisable & ~1) | new; + if (old) *old = self->canceldisable; + if (new > 1U) return EINVAL; + self->canceldisable = new; return 0; }