Просмотр исходного кода

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..
Andreas Kling 6 лет назад
Родитель
Сommit
c79b048198
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      AK/MappedFile.cpp

+ 2 - 1
AK/MappedFile.cpp

@@ -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;