diff options
author | Frank Kühndel <frank.kuehndel@embedded-brains.de> | 2021-05-11 16:26:55 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-12 06:41:10 +0200 |
commit | 3af2dc7802164d6c22dbef1f144c9bd945a35c30 (patch) | |
tree | 6c34fd16da24213f89fde232dd6a0f7ccf87cf35 /cpukit/rtems/src/taskwakewhen.c | |
parent | rtems: Use _Objects_Free_nothing() for msg queues (diff) | |
download | rtems-3af2dc7802164d6c22dbef1f144c9bd945a35c30.tar.bz2 |
_TOD_Validate(): Fix incorrect return code
This patch fixes bug #4403. Directives
* rtems_timer_fire_when()
* rtems_timer_server_fire_when()
* rtems_task_wake_when()
are documented to return RTEMS_INVALID_ADDRESS when their time-of-day
argument is NULL. But actually they return RTEMS_INVALID_CLOCK. To fix
the issue this patch changes _TOD_Validate() to return a
status code instead of just true/false.
Close #4403
Diffstat (limited to 'cpukit/rtems/src/taskwakewhen.c')
-rw-r--r-- | cpukit/rtems/src/taskwakewhen.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c index 5f6a5795fc..a25204ad01 100644 --- a/cpukit/rtems/src/taskwakewhen.c +++ b/cpukit/rtems/src/taskwakewhen.c @@ -30,9 +30,10 @@ rtems_status_code rtems_task_wake_when( rtems_time_of_day *time_buffer ) { - uint32_t seconds; - Thread_Control *executing; - Per_CPU_Control *cpu_self; + uint32_t seconds; + Thread_Control *executing; + Per_CPU_Control *cpu_self; + rtems_status_code status; if ( !_TOD_Is_set() ) return RTEMS_NOT_DEFINED; @@ -41,9 +42,11 @@ rtems_status_code rtems_task_wake_when( return RTEMS_INVALID_ADDRESS; time_buffer->ticks = 0; + status = _TOD_Validate( time_buffer ); - if ( !_TOD_Validate( time_buffer ) ) - return RTEMS_INVALID_CLOCK; + if ( status != RTEMS_SUCCESSFUL ) { + return status; + } seconds = _TOD_To_seconds( time_buffer ); |