summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2011-02-01 05:43:21 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2011-02-01 05:43:21 +0000
commitfe7c9a1f83c0583d6287e2e3fe6995407465f479 (patch)
tree4ad918eb0a36c38738e58870411371658481d4f3 /cpukit
parent2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org> (diff)
downloadrtems-fe7c9a1f83c0583d6287e2e3fe6995407465f479.tar.bz2
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
* libmisc/stringto/stringtoint.c: Reformat range check. Add check for result==0.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog2
-rw-r--r--cpukit/libmisc/stringto/stringtoint.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 8aec3a32f5..3a5dc3435c 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
+ * libmisc/stringto/stringtoint.c: Reformat range check.
+ Add check for result==0.
* libmisc/stringto/stringtofloat.c: Reformat range check.
Add check for result = -HUGE_VALF.
* libmisc/stringto/stringtodouble.c: Reformat range check.
diff --git a/cpukit/libmisc/stringto/stringtoint.c b/cpukit/libmisc/stringto/stringtoint.c
index 41cf3c288a..8e3663b496 100644
--- a/cpukit/libmisc/stringto/stringtoint.c
+++ b/cpukit/libmisc/stringto/stringtoint.c
@@ -49,11 +49,9 @@ rtems_status_code rtems_string_to_int (
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == LONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == LONG_MIN) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == LONG_MAX ) || ( result == LONG_MIN )))
+ return RTEMS_INVALID_NUMBER;
#if (INT_MAX < LONG_MAX)
if ( result > INT_MAX ) {