From c79b0481985325a5afb6dce30a0174cce18f313d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 8 Jul 2019 13:59:10 +0200 Subject: [PATCH] MappedFile: Fix misuse of StringView::characters(). This makes me wonder if the open() syscall should take characters+length and we'd compute the length at the LibC layer instead. That way we could also provide an optional non-POSIX open() that takes the length directly.. --- AK/MappedFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AK/MappedFile.cpp b/AK/MappedFile.cpp index 87af44be9c..68e2a7abfb 100644 --- a/AK/MappedFile.cpp +++ b/AK/MappedFile.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -12,7 +13,7 @@ namespace AK { MappedFile::MappedFile(const StringView& file_name) { m_size = PAGE_SIZE; - m_fd = open(file_name.characters(), O_RDONLY | O_CLOEXEC); + m_fd = open(String(file_name).characters(), O_RDONLY | O_CLOEXEC); if (m_fd != -1) { struct stat st;