summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-09-05 20:29:07 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-09-05 20:29:07 +0000
commit9a5cbef006b6e42c38648358314341b7c1c8f255 (patch)
treefb40d139359e2abb2c795d0ceb78b69025e753a7 /cpukit/posix
parentnanosleep no longer consider a negative value of tv_sec to be an error. (diff)
downloadrtems-9a5cbef006b6e42c38648358314341b7c1c8f255.tar.bz2
nanosleep: negative value for tv_sec is no longer an error. It now
is changed into being a 0 delay.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/time.c14
1 files changed, 10 insertions, 4 deletions
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