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..
This commit is contained in:
Andreas Kling 2019-07-08 13:59:10 +02:00
commit c79b048198
Notes: sideshowbarker 2024-07-19 13:22:15 +09:00

View file

@ -1,3 +1,4 @@
#include <AK/AKString.h>
#include <AK/MappedFile.h>
#include <fcntl.h>
#include <stdio.h>
@ -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;