summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2011-02-01 05:29:26 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2011-02-01 05:29:26 +0000
commit80604fa73b7c6594ceeb769245ff5fc17412ae88 (patch)
treecf4fe0664f4ede8c0910513055a6a83aa6447711 /cpukit
parent2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org> (diff)
downloadrtems-80604fa73b7c6594ceeb769245ff5fc17412ae88.tar.bz2
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
* libmisc/stringto/stringtolong.c: Reformat range check. Add check for result==0.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog5
-rw-r--r--cpukit/libmisc/stringto/stringtolong.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 36ead29898..8c0a4a292f 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,4 +1,9 @@
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
+
+ * libmisc/stringto/stringtolong.c: Reformat range check.
+ Add check for result==0.
+
+2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
* libmisc/Makefile.am: Remove stringto/stringto_template.h.
* libmisc/stringto/stringto_template.h: Remove.
diff --git a/cpukit/libmisc/stringto/stringtolong.c b/cpukit/libmisc/stringto/stringtolong.c
index 9800c537d1..e77b8822b8 100644
--- a/cpukit/libmisc/stringto/stringtolong.c
+++ b/cpukit/libmisc/stringto/stringtolong.c
@@ -49,11 +49,9 @@ rtems_status_code rtems_string_to_long (
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;
*n = result;