From 9a5cbef006b6e42c38648358314341b7c1c8f255 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 5 Sep 1996 20:29:07 +0000 Subject: nanosleep: negative value for tv_sec is no longer an error. It now is changed into being a 0 delay. --- cpukit/posix/src/time.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'cpukit/posix') diff --git a/cpukit/posix/src/time.c b/cpukit/posix/src/time.c index 3302f78554..125db4d16b 100644 --- a/cpukit/posix/src/time.c +++ b/cpukit/posix/src/time.c @@ -245,11 +245,14 @@ int nanosleep( struct timespec *rmtp ) { - Watchdog_Interval ticks; + Watchdog_Interval ticks; + struct timespec *the_rqtp; if ( !rqtp ) set_errno_and_return_minus_one( EINVAL ); + the_rqtp = (struct timespec *)rqtp; + /* * Return EAGAIN if the delay interval is negative. * @@ -257,13 +260,16 @@ int nanosleep( * FSU pthreads shares this behavior. */ - if ( rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 ) + if ( the_rqtp->tv_sec < 0 ) + the_rqtp->tv_sec = 0; + + if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 ) set_errno_and_return_minus_one( EAGAIN ); - if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) + if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) set_errno_and_return_minus_one( EINVAL ); - ticks = _POSIX_Timespec_to_interval( rqtp ); + ticks = _POSIX_Timespec_to_interval( the_rqtp ); /* * This behavior is also beyond the POSIX specification but is -- cgit v1.2.3