This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit bf7c92815a1943e39c521c74fab766d48c88f5dc Author: Marco Casaroli <[email protected]> AuthorDate: Wed Nov 4 11:00:58 2026 +0100 libs/libc/pthread: Return the errno of boardctl() from the spinlock functions. boardctl() returns -1 and sets errno on failure. pthread_spin_lock() and pthread_spin_trylock() returned -ret, so pthread_spin_trylock() of a lock that another thread holds returned 1 (EPERM), not EBUSY. Return errno. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- libs/libc/pthread/pthread_spinlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/libc/pthread/pthread_spinlock.c b/libs/libc/pthread/pthread_spinlock.c index 627086a3327..465dbab5f39 100644 --- a/libs/libc/pthread/pthread_spinlock.c +++ b/libs/libc/pthread/pthread_spinlock.c @@ -193,7 +193,7 @@ int pthread_spin_lock(pthread_spinlock_t *lock) /* An error of some kind is the only other possibility */ DEBUGASSERT(ret < 0); - ret = -ret; + ret = get_errno(); } return ret; @@ -250,7 +250,7 @@ int pthread_spin_trylock(pthread_spinlock_t *lock) else /* Previously locked. We did not get the spinlock */ { DEBUGASSERT(ret < 0); - ret = -ret; + ret = get_errno(); } }
