ftok:check mkdir return value.

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
This commit is contained in:
yangguangcai 2024-09-05 15:04:34 +08:00 committed by Xiang Xiao
parent f45eaa608d
commit 523b72d095
1 changed files with 2 additions and 2 deletions

View File

@ -66,8 +66,8 @@ key_t ftok(FAR const char *pathname, int proj_id)
{
/* Directory not exist, let's create one for caller */
mkdir(fullpath, S_IRWXU);
if (stat(fullpath, &st) < 0)
if (mkdir(fullpath, S_IRWXU) < 0 ||
stat(fullpath, &st) < 0)
{
return (key_t)-1;
}