summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libmisc')
-rw-r--r--cpukit/libmisc/stringto/stringtolong.c8
1 files changed, 3 insertions, 5 deletions
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;