summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-17 13:39:15 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-17 13:43:55 +0200
commitf502882ef5dec2149baf9511e6543ce7b2884bdf (patch)
tree0a8cd6251ade8a34b4e2c617a565f5a37b60be23 /cpukit
parentposix: Fix return status of pthread_cancel() (diff)
downloadrtems-f502882ef5dec2149baf9511e6543ce7b2884bdf.tar.bz2
posix: Fix return states of pthread_kill()
POSIX mandates that an error code is returned and not -1 plus errno. Update #2715.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/posix/src/pthreadkill.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c
index 2e44dc61db..897f4c502a 100644
--- a/cpukit/posix/src/pthreadkill.c
+++ b/cpukit/posix/src/pthreadkill.c
@@ -28,7 +28,6 @@
#include <rtems/posix/psignalimpl.h>
#include <rtems/score/isr.h>
#include <rtems/score/threadimpl.h>
-#include <rtems/seterr.h>
int pthread_kill(
pthread_t thread,
@@ -39,11 +38,9 @@ int pthread_kill(
Thread_Control *the_thread;
Objects_Locations location;
- if ( !sig )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- if ( !is_valid_signo(sig) )
- rtems_set_errno_and_return_minus_one( EINVAL );
+ if ( !is_valid_signo( sig ) ) {
+ return EINVAL;
+ }
the_thread = _Thread_Get( thread, &location );
switch ( location ) {
@@ -55,19 +52,16 @@ int pthread_kill(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- if ( sig ) {
-
- if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
- _Objects_Put( &the_thread->Object );
- return 0;
- }
+ if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
+ _Objects_Put( &the_thread->Object );
+ return 0;
+ }
- /* XXX critical section */
+ /* XXX critical section */
- api->signals_pending |= signo_to_mask( sig );
+ api->signals_pending |= signo_to_mask( sig );
- (void) _POSIX_signals_Unblock_thread( the_thread, sig, NULL );
- }
+ (void) _POSIX_signals_Unblock_thread( the_thread, sig, NULL );
_Objects_Put( &the_thread->Object );
return 0;
@@ -78,5 +72,5 @@ int pthread_kill(
break;
}
- rtems_set_errno_and_return_minus_one( ESRCH );
+ return ESRCH;
}