Skip to content

Commit

Permalink
ftok:check mkdir return value.
Browse files Browse the repository at this point in the history
Signed-off-by: yangguangcai <[email protected]>
  • Loading branch information
yangguangcai1 authored and xiaoxiang781216 committed Sep 28, 2024
1 parent f45eaa6 commit 523b72d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/libc/misc/lib_ftok.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 523b72d

Please sign in to comment.