ksrc: Fix pthread_create return value sign when xnthread_register fails
PATCH 1/1 ksrc: Fix pthread_create return value sign when xnthread_register fails
xnthread_register returns negative errors, but pthread_create returns positive errors, so the return value has to be negated before being passed on, otherwise the caller of pthread_create will use the return value as a valid thread id.
Signed-off-by Len Sorensen <[email protected]>
--- ksrc/skins/posix/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ksrc/skins/posix/thread.c +1 -1
@@ -258,7 +258,7 @@ int pthread_create(pthread_t *tid, ret =xnthread_register (&thread->threadbase,"" );if (ret) {thread_destroy (thread); -return ret; +return -ret; } *tid = thread;/* Must be done before the thread is started. */
Signature · 1 line
1.7.10.4
Quoted 25 lines · Lennart Sorensen
xnthread_registerreturns negative errors, butpthread_createreturns positive errors, so the return value has to be negated before being passed on, otherwise the caller ofpthread_createwill use the return value as a valid thread id.Signed-off-by Len Sorensen <[email protected]>--- ksrc/skins/posix/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ksrc/skins/posix/thread.c +1
-1@@ -258,7 +258,7 @@ int pthread_create(pthread_t *tid, ret =xnthread_register (&thread->threadbase,"" );if (ret) {thread_destroy (thread); -return ret; +return -ret; } *tid = thread;/* Must be done before the thread is started. */ Signature · 1 line
1.7.10.4
This is for xenomai-2.6
Signature · 1 line
Len Sorensen