summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/stringto/stringtounsignedchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libmisc/stringto/stringtounsignedchar.c')
-rw-r--r--cpukit/libmisc/stringto/stringtounsignedchar.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/cpukit/libmisc/stringto/stringtounsignedchar.c b/cpukit/libmisc/stringto/stringtounsignedchar.c
index 6bd28c6494..5223b03fb7 100644
--- a/cpukit/libmisc/stringto/stringtounsignedchar.c
+++ b/cpukit/libmisc/stringto/stringtounsignedchar.c
@@ -49,11 +49,9 @@ rtems_status_code rtems_string_to_unsigned_char (
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == ULONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == 0) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == ULONG_MAX )))
+ return RTEMS_INVALID_NUMBER;
#if (UCHAR_MAX < ULONG_MAX)
if ( result > UCHAR_MAX ) {