From f5dc557118e74876e3b11a51bf4d32d736785754 Mon Sep 17 00:00:00 2001 From: Jennifer Averett Date: Tue, 22 Jun 2010 15:36:06 +0000 Subject: 2010-06-22 Jennifer Averett * posix/src/nanosleep.c, posix/src/timersettime.c: Removed redundent code and cleaned up error checking code. --- cpukit/posix/src/nanosleep.c | 4 +--- cpukit/posix/src/timersettime.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'cpukit/posix') diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c index e83f1c8277..5031039c24 100644 --- a/cpukit/posix/src/nanosleep.c +++ b/cpukit/posix/src/nanosleep.c @@ -36,8 +36,6 @@ int nanosleep( { Watchdog_Interval ticks; - if ( !_Timespec_Is_valid( rqtp ) ) - rtems_set_errno_and_return_minus_one( EINVAL ); /* * Return EINVAL if the delay interval is negative. @@ -45,7 +43,7 @@ int nanosleep( * NOTE: This behavior is beyond the POSIX specification. * FSU and GNU/Linux pthreads shares this behavior. */ - if ( rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 ) + if ( !_Timespec_Is_valid( rqtp ) ) rtems_set_errno_and_return_minus_one( EINVAL ); ticks = _Timespec_To_ticks( rqtp ); diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c index de81dab694..d618bd391e 100644 --- a/cpukit/posix/src/timersettime.c +++ b/cpukit/posix/src/timersettime.c @@ -42,12 +42,14 @@ int timer_settime( if ( !value ) rtems_set_errno_and_return_minus_one( EINVAL ); - /* First, it verifies if the structure "value" is correct */ - if ( ( value->it_value.tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) || - ( value->it_value.tv_nsec < 0 ) || - ( value->it_interval.tv_nsec >= TOD_NANOSECONDS_PER_SECOND) || - ( value->it_interval.tv_nsec < 0 )) { - /* The number of nanoseconds is not correct */ + /* + * First, it verifies if the structure "value" is correct + * if the number of nanoseconds is not correct return EINVAL + */ + if ( !_Timespec_Is_valid( &(value->it_value) ) ) { + rtems_set_errno_and_return_minus_one( EINVAL ); + } + if ( !_Timespec_Is_valid( &(value->it_interval) ) ) { rtems_set_errno_and_return_minus_one( EINVAL ); } -- cgit v1.2.3