Skip to content

Commit c79b048

Browse files
committed
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..
1 parent a8aadf7 commit c79b048

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

AK/MappedFile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <AK/AKString.h>
12
#include <AK/MappedFile.h>
23
#include <fcntl.h>
34
#include <stdio.h>
@@ -12,7 +13,7 @@ namespace AK {
1213
MappedFile::MappedFile(const StringView& file_name)
1314
{
1415
m_size = PAGE_SIZE;
15-
m_fd = open(file_name.characters(), O_RDONLY | O_CLOEXEC);
16+
m_fd = open(String(file_name).characters(), O_RDONLY | O_CLOEXEC);
1617

1718
if (m_fd != -1) {
1819
struct stat st;

0 commit comments

Comments
 (0)