libc logic should not directly assign errno, but should use set_errno() macro. This is because in the kernel build, errno is a system call

This commit is contained in:
Gregory Nutt 2013-12-11 14:54:22 -06:00
parent 70a8510fb9
commit bdf1ad69d6
4 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ double sqrt(double x)
if (x < 0.0)
{
errno = EDOM;
set_errno(EDOM);
return NAN;
}

View File

@ -49,7 +49,7 @@ float sqrtf(float x)
if (x < 0.0)
{
errno = EDOM;
set_errno(EDOM);
return NAN;
}

View File

@ -50,7 +50,7 @@ long double sqrtl(long double x)
if (x < 0.0)
{
errno = EDOM;
set_errno(EDOM);
return NAN;
}

View File

@ -446,7 +446,7 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
long tmplong;
errsave = errno;
errno = 0;
set_errno(0);
tmplong = strtol(tmp, &endptr, base);
/* Number can't be converted */
@ -456,7 +456,7 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
return count;
}
errno = errsave;
set_errno(errno);
/* We have to check whether we need to return a long
* or an int.
@ -556,7 +556,7 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
double_t dvalue;
errsave = errno;
errno = 0;
set_errno(0);
dvalue = strtod(tmp, &endptr);
/* Number can't be converted */
@ -566,7 +566,7 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
return count;
}
errno = errsave;
set_errno(errsave);
/* We have to check whether we need to return a float
* or a double.