mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibCore: Use open() wrapper in Core::MappedFile :^)
This commit is contained in:
parent
50416c286d
commit
0ed5f84bd9
Notes:
sideshowbarker
2024-07-18 00:48:54 +09:00
Author: https://github.com/awesomekling
Commit: 0ed5f84bd9
2 changed files with 2 additions and 7 deletions
|
@ -8,20 +8,15 @@
|
|||
#include <AK/String.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
ErrorOr<NonnullRefPtr<MappedFile>> MappedFile::map(String const& path)
|
||||
{
|
||||
int fd = open(path.characters(), O_RDONLY | O_CLOEXEC, 0);
|
||||
if (fd < 0)
|
||||
return Error::from_errno(errno);
|
||||
|
||||
auto fd = TRY(Core::System::open(path, O_RDONLY | O_CLOEXEC, 0));
|
||||
return map_from_fd_and_close(fd, path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue