Fix handling of NULL pointer in sig_timedwait()

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4129 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-11-29 18:21:52 +00:00
parent 34f1a907b4
commit 75ee14b862
2 changed files with 13 additions and 5 deletions

View File

@ -2224,4 +2224,6 @@
board.
* include/sys/types.h: wchar_t is a builtin type in C++ and its
declaration can cause errors with certain C++ compilers.
* sched/sig_timedwait.c: Fix signal handling with the returned info
is NULL. Before this change, it would derefence a NULL pointer
in this case.

View File

@ -277,12 +277,18 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
if (info)
{
memcpy(info, &rtcb->sigunbinfo, sizeof(struct siginfo));
/* The return value is the number of the signal that awakened us */
ret = info->si_signo;
}
else
{
/* We don't know which signal awakened us. This is probably a bug. */
ret = 0;
}
irqrestore(saved_state);
/* The return value is the number of the signal that awakened us */
ret = info->si_signo;
}
sched_unlock();