From 54b4b1f85af465acb4627ec423599a6c3b4a6fad Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 3 Sep 2021 09:46:36 +0200 Subject: score: Add _TOD_Is_valid_new_time_of_day() Move the TOD validation to the callers of _TOD_Set(). This avoids dead code in case only rtems_clock_set() is used in an application because rtems_clock_set() always calls _TOD_Set() with a valid time of day. --- cpukit/posix/src/clocksettime.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cpukit/posix/src/clocksettime.c') diff --git a/cpukit/posix/src/clocksettime.c b/cpukit/posix/src/clocksettime.c index 53e728762e..23bb14a86d 100644 --- a/cpukit/posix/src/clocksettime.c +++ b/cpukit/posix/src/clocksettime.c @@ -41,6 +41,11 @@ int clock_settime( if ( clock_id == CLOCK_REALTIME ) { ISR_lock_Context lock_context; + status = _TOD_Is_valid_new_time_of_day( tp ); + if ( status != STATUS_SUCCESSFUL ) { + rtems_set_errno_and_return_minus_one( STATUS_GET_POSIX( status ) ); + } + _TOD_Lock(); _TOD_Acquire( &lock_context ); status = _TOD_Set( tp, &lock_context ); -- cgit v1.2.3