libc: memfd_create should create /tmp/memfd/ before creating file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-06-11 23:55:51 +08:00 committed by Petro Karashchenko
parent 43f9abf84f
commit 1a06f7a2c9

View File

@ -23,6 +23,7 @@
****************************************************************************/ ****************************************************************************/
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
@ -56,6 +57,7 @@ int memfd_create(FAR const char *name, unsigned int flags)
# ifdef CONFIG_LIBC_MEMFD_SHMFS # ifdef CONFIG_LIBC_MEMFD_SHMFS
return shm_open(path, O_RDWR | flags, 0660); return shm_open(path, O_RDWR | flags, 0660);
# else # else
mkdir(LIBC_MEM_FD_VFS_PATH, 0666);
return open(path, O_RDWR | flags, 0660); return open(path, O_RDWR | flags, 0660);
# endif # endif
#endif #endif