1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 05:24:58 +00:00

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
parent a8aadf73e9
commit c79b048198

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;