Use get_errno() instead of errno because I may do something different if used inside the OS

This commit is contained in:
Gregory Nutt 2014-03-30 11:33:47 -06:00
parent fa5988bf7b
commit e6bd002d68

View File

@ -458,13 +458,15 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
int errsave;
long tmplong;
errsave = errno;
/* Preserve the errno value */
errsave = get_errno();
set_errno(0);
tmplong = strtol(tmp, &endptr, base);
/* Number can't be converted */
if (tmp == endptr || errno == ERANGE)
if (tmp == endptr || get_errno() == ERANGE)
{
return count;
}
@ -568,13 +570,15 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
int errsave;
double_t dvalue;
errsave = errno;
/* Preserve the errno value */
errsave = get_errno();
set_errno(0);
dvalue = strtod(tmp, &endptr);
/* Number can't be converted */
if (tmp == endptr || errno == ERANGE)
if (tmp == endptr || get_errno() == ERANGE)
{
return count;
}