forked from nuttx/nuttx-update
timer_create:Checks whether the signo provided by the user is valid
Summary: When the user sets an illegal signo, the error will only be known when timer_signotify is triggered during timeout. By intercepting timer_create, we can directly locate the problem Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
9b1800d043
commit
9a75519edc
1 changed files with 3 additions and 1 deletions
|
@ -164,7 +164,9 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp,
|
|||
/* Sanity checks. */
|
||||
|
||||
if (timerid == NULL || (clockid != CLOCK_REALTIME &&
|
||||
clockid != CLOCK_MONOTONIC && clockid != CLOCK_BOOTTIME))
|
||||
clockid != CLOCK_MONOTONIC && clockid != CLOCK_BOOTTIME) ||
|
||||
(evp != NULL && evp->sigev_notify == SIGEV_SIGNAL &&
|
||||
!GOOD_SIGNO(evp->sigev_signo)))
|
||||
{
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
|
|
Loading…
Reference in a new issue