mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
fix strtoul() odd interface
This commit is contained in:
parent
94c3bc332d
commit
716d1770a2
@ -362,6 +362,11 @@ lutil_atoux( unsigned *v, const char *s, int x )
|
||||
assert( s != NULL );
|
||||
assert( v != NULL );
|
||||
|
||||
/* strtoul() has an odd interface */
|
||||
if ( s[ 0 ] == '-' ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
u = strtoul( s, &next, x );
|
||||
if ( next == s || next[ 0 ] != '\0' ) {
|
||||
return -1;
|
||||
@ -404,6 +409,11 @@ lutil_atoulx( unsigned long *v, const char *s, int x )
|
||||
assert( s != NULL );
|
||||
assert( v != NULL );
|
||||
|
||||
/* strtoul() has an odd interface */
|
||||
if ( s[ 0 ] == '-' ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ul = strtoul( s, &next, x );
|
||||
if ( next == s || next[ 0 ] != '\0' ) {
|
||||
return -1;
|
||||
@ -433,6 +443,11 @@ lutil_parse_time(
|
||||
unsigned long u;
|
||||
char *what;
|
||||
|
||||
/* strtoul() has an odd interface */
|
||||
if ( s[ 0 ] == '-' ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
u = strtoul( s, &next, 10 );
|
||||
if ( next == s ) {
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user