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:
parent
34f1a907b4
commit
75ee14b862
@ -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.
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user