diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-24 23:18:32 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-24 23:18:32 +0000 |
commit | a2ec48846f786e72a976038c9467b25a61ad5a9f (patch) | |
tree | c4f4fcda6c667b7928c3b2aaa89a81027e298b47 /nuttx/sched/sig_action.c | |
parent | 25e9b8d0846b68a18014c63146234193bfe539e8 (diff) | |
download | px4-firmware-a2ec48846f786e72a976038c9467b25a61ad5a9f.tar.gz px4-firmware-a2ec48846f786e72a976038c9467b25a61ad5a9f.tar.bz2 px4-firmware-a2ec48846f786e72a976038c9467b25a61ad5a9f.zip |
Fix some missing logic and inconsistencies in child status logic; Fix a bug introduced into sigaction()
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5560 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sig_action.c')
-rw-r--r-- | nuttx/sched/sig_action.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/nuttx/sched/sig_action.c b/nuttx/sched/sig_action.c index 708667993..7d84b6291 100644 --- a/nuttx/sched/sig_action.c +++ b/nuttx/sched/sig_action.c @@ -169,7 +169,6 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction * { FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; FAR sigactq_t *sigact; - int ret; /* Since sigactions can only be installed from the running thread of * execution, no special precautions should be necessary. @@ -251,24 +250,31 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction * if (act->sa_u._sa_handler == SIG_IGN) { - /* If there is a old sigaction, remove it from sigactionq */ + /* Do we still have a sigaction container from the previous setting? */ - sq_rem((FAR sq_entry_t*)sigact, &rtcb->sigactionq); + if (sigact) + { + /* Yes.. Remove it from sigactionq */ + + sq_rem((FAR sq_entry_t*)sigact, &rtcb->sigactionq); - /* And deallocate it */ + /* And deallocate it */ - sig_releaseaction(sigact); + sig_releaseaction(sigact); + } } /* A sigaction has been supplied */ else { - /* Check if a sigaction was found */ + /* Do we still have a sigaction container from the previous setting? + * If so, then re-use for the new signal action. + */ if (!sigact) { - /* No sigaction was found, but one is needed. Allocate one. */ + /* No.. Then we need to allocate one for the new action. */ sigact = sig_allocateaction(); @@ -294,7 +300,7 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction * COPY_SIGACTION(&sigact->act, act); } - return ret; + return OK; } /**************************************************************************** |