diff --git a/kernel/src/fs/tmpfs/FileSystem.cpp b/kernel/src/fs/tmpfs/FileSystem.cpp index 76e095bd..772433cc 100644 --- a/kernel/src/fs/tmpfs/FileSystem.cpp +++ b/kernel/src/fs/tmpfs/FileSystem.cpp @@ -45,7 +45,7 @@ namespace TmpFS { for (const auto& entry : m_entries) { - if (!strcmp(name, entry.name)) return entry.inode; + if (!strcmp(name, entry.name.chars())) return entry.inode; } return err(ENOENT); @@ -53,9 +53,7 @@ namespace TmpFS Result DirInode::add_entry(SharedPtr inode, const char* name) { - Entry entry; - entry.inode = inode; - strlcpy(entry.name, name, sizeof(entry.name)); + Entry entry { inode, name }; TRY(m_entries.try_append(move(entry))); diff --git a/kernel/src/fs/tmpfs/FileSystem.h b/kernel/src/fs/tmpfs/FileSystem.h index 63cf7abe..6e1e5f39 100644 --- a/kernel/src/fs/tmpfs/FileSystem.h +++ b/kernel/src/fs/tmpfs/FileSystem.h @@ -2,7 +2,7 @@ #include "fs/VFS.h" #include #include -#include +#include #include namespace TmpFS @@ -110,7 +110,7 @@ namespace TmpFS struct Entry { SharedPtr inode; - char name[128]; + StaticString<128> name; }; Vector m_entries;