getservbyport_r: fix wrong result if getnameinfo fails with EAI_OVERFLOW
[musl] / src / thread / pthread_spin_trylock.c
index 59de695..5284fda 100644 (file)
@@ -1,6 +1,7 @@
 #include "pthread_impl.h"
+#include <errno.h>
 
 int pthread_spin_trylock(pthread_spinlock_t *s)
 {
-       return -a_swap(s, 1) & EBUSY;
+       return a_cas(s, 0, EBUSY);
 }