From 61bbacea0a14c09c8e03491db7211cb2e57fe2b3 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Tue, 1 Feb 2011 05:41:07 +0000 Subject: [PATCH] 2011-02-01 Ralf Corsepius * libmisc/stringto/stringtodouble.c: Reformat range check. Add check for result = -HUGE_VAL. --- cpukit/ChangeLog | 2 ++ cpukit/libmisc/stringto/stringtodouble.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 19db9bd6a0..b6c68e19af 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,7 @@ 2011-02-01 Ralf Corsepius + * libmisc/stringto/stringtodouble.c: Reformat range check. + Add check for result = -HUGE_VAL. * libmisc/stringto/stringtolonglong.c: Reformat range check. c99 portability improvements. Add check for result==0. * libmisc/stringto/stringtounsignedlonglong.c: Reformat range check. diff --git a/cpukit/libmisc/stringto/stringtodouble.c b/cpukit/libmisc/stringto/stringtodouble.c index bee9384891..ec50a1332b 100644 --- a/cpukit/libmisc/stringto/stringtodouble.c +++ b/cpukit/libmisc/stringto/stringtodouble.c @@ -48,9 +48,8 @@ rtems_status_code rtems_string_to_double ( if ( end == s ) return RTEMS_NOT_DEFINED; - if ( (result == HUGE_VAL) && (errno == ERANGE)) - return RTEMS_INVALID_NUMBER; - if ( (result == 0) && (errno == ERANGE)) + if ( ( errno == ERANGE ) && + (( result == 0 ) || ( result == HUGE_VAL ) || ( result == -HUGE_VAL ))) return RTEMS_INVALID_NUMBER; *n = result;