X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_setcancelstate.c;h=aa0ddcdd316341ec0ab7a685e2e84a5a8a2b149b;hb=feee98903cd8119d9a3db62589246a940f44a9f5;hp=a85cc800f7c64f8736133c2fad6ec6bff3ee791f;hpb=729cb49f52c825ac44f437e1ff0865d9f0b3626a;p=musl 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; }