Ensure the kernel component don't call userspace API

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2021-03-01 09:23:09 +09:00
committed by Masayuki Ishikawa
parent cf73496d9e
commit 9473434587
224 changed files with 769 additions and 809 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ FAR char *mktemp(FAR char *path_template)
/* Attempt to stat the candidate file */
ret = stat(path_template, &buf);
if (ret < 0 && errno == ENOENT)
if (ret < 0 && get_errno() == ENOENT)
{
/* We have it... Clear the errno and return the template */
+7 -7
View File
@@ -52,13 +52,13 @@ FAR char *realpath(FAR const char *path, FAR char *resolved)
if (path == NULL)
{
errno = EINVAL;
set_errno(EINVAL);
return NULL;
}
if (*path == '\0')
{
errno = ENOENT;
set_errno(ENOENT);
return NULL;
}
@@ -159,7 +159,7 @@ loop:
if (p - resolved + 1 + q - path + 1 > PATH_MAX)
{
errno = ENAMETOOLONG;
set_errno(ENAMETOOLONG);
goto out;
}
@@ -181,7 +181,7 @@ loop:
{
if (nlnk++ >= SYMLOOP_MAX)
{
errno = ELOOP;
set_errno(ELOOP);
goto out;
}
@@ -190,7 +190,7 @@ loop:
{
if (n == 0)
{
errno = ENOENT;
set_errno(ENOENT);
}
goto out;
@@ -200,7 +200,7 @@ loop:
if (n + (len = strlen(q)) + 1 > sizeof(wbuf[0]))
{
errno = ENAMETOOLONG;
set_errno(ENAMETOOLONG);
goto out;
}
@@ -221,7 +221,7 @@ loop:
if (*q == '/' && !S_ISDIR(sb.st_mode))
{
errno = ENOTDIR;
set_errno(ENOTDIR);
goto out;
}