Set endptr if the base is not supported. The opengroup spec does not special

case this condition. Note: glibc has the same problem.
This commit is contained in:
christos 2009-05-20 22:03:29 +00:00
parent fd67370208
commit f1dbbfab6d
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: _strtol.h,v 1.1 2008/08/20 12:42:26 joerg Exp $ */
/* $NetBSD: _strtol.h,v 1.2 2009/05/20 22:03:29 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -57,7 +57,10 @@ _FUNCNAME(const char *nptr, char **endptr, int base)
if (base && (base < 2 || base > 36)) {
#if !defined(_KERNEL) && !defined(_STANDALONE)
errno = EINVAL;
return(0);
if (endptr != NULL)
/* LINTED interface specification */
*endptr = __UNCONST(nptr);
return 0;
#else
panic("%s: invalid base %d", __func__, base);
#endif