mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
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:
@@ -164,7 +164,9 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp,
|
|||||||
/* Sanity checks. */
|
/* Sanity checks. */
|
||||||
|
|
||||||
if (timerid == NULL || (clockid != CLOCK_REALTIME &&
|
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);
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user