From 3af2dc7802164d6c22dbef1f144c9bd945a35c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20K=C3=BChndel?= Date: Tue, 11 May 2021 16:26:55 +0200 Subject: _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 --- cpukit/rtems/src/timercreate.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cpukit/rtems/src/timercreate.c') diff --git a/cpukit/rtems/src/timercreate.c b/cpukit/rtems/src/timercreate.c index a3ece5cc4d..bd9421c440 100644 --- a/cpukit/rtems/src/timercreate.c +++ b/cpukit/rtems/src/timercreate.c @@ -132,7 +132,8 @@ rtems_status_code _Timer_Fire_when( Watchdog_Service_routine_entry adaptor ) { - rtems_interval seconds; + rtems_status_code status; + rtems_interval seconds; if ( !_TOD_Is_set() ) return RTEMS_NOT_DEFINED; @@ -140,8 +141,11 @@ rtems_status_code _Timer_Fire_when( if ( !routine ) return RTEMS_INVALID_ADDRESS; - if ( !_TOD_Validate( wall_time ) ) - return RTEMS_INVALID_CLOCK; + status = _TOD_Validate( wall_time ); + + if ( status != RTEMS_SUCCESSFUL ) { + return status; + } seconds = _TOD_To_seconds( wall_time ); if ( seconds <= _TOD_Seconds_since_epoch() ) -- cgit v1.2.3