diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-26 14:58:07 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-27 10:48:16 +0200 |
commit | 58a58896107d0493da0cc83a6b6b8089687eb2b4 (patch) | |
tree | 32158e0b46e128ca16e676b31bab81cdb0b013cb | |
parent | score: Add and use CHAIN_INITIALIZER_ONE_NODE(). (diff) | |
download | rtems-58a58896107d0493da0cc83a6b6b8089687eb2b4.tar.bz2 |
posix: Protect access to _POSIX_signals_Vectors
Assume the sigaction() is called only from thread context. Protect
against concurrent sigaction() invocations by different threads.
-rw-r--r-- | cpukit/posix/src/sigaction.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/cpukit/posix/src/sigaction.c b/cpukit/posix/src/sigaction.c index 8dacc70181..d5300ebd9f 100644 --- a/cpukit/posix/src/sigaction.c +++ b/cpukit/posix/src/sigaction.c @@ -44,9 +44,6 @@ int sigaction( { ISR_Level level; - if ( oact ) - *oact = _POSIX_signals_Vectors[ sig ]; - if ( !sig ) rtems_set_errno_and_return_minus_one( EINVAL ); @@ -63,6 +60,11 @@ int sigaction( if ( sig == SIGKILL ) rtems_set_errno_and_return_minus_one( EINVAL ); + _Thread_Disable_dispatch(); + + if ( oact ) + *oact = _POSIX_signals_Vectors[ sig ]; + /* * Evaluate the new action structure and set the global signal vector * appropriately. @@ -85,14 +87,7 @@ int sigaction( _ISR_Enable( level ); } - /* - * No need to evaluate or dispatch because: - * - * + If we were ignoring the signal before, none could be pending - * now (signals not posted when SIG_IGN). - * + If we are now ignoring a signal that was previously pending, - * we clear the pending signal indicator. - */ + _Thread_Enable_dispatch(); return 0; } |