From adb9b86807a8d7f29d53df18c0db8983566750e1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Nov 2021 12:02:43 +0100 Subject: [PATCH] LibGfx: Use Core::System::open() in Gfx::Bitmap :^) --- Userland/Libraries/LibGfx/Bitmap.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index 32ff60175c..468dfe07c4 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -113,9 +114,7 @@ ErrorOr> Bitmap::try_load_from_file(String const& path, in highdpi_icon_path.append(lexical_path.extension()); auto highdpi_icon_string = highdpi_icon_path.to_string(); - int fd = open(highdpi_icon_string.characters(), O_RDONLY); - if (fd < 0) - return Error::from_errno(errno); + auto fd = TRY(Core::System::open(highdpi_icon_string, O_RDONLY)); auto bitmap = TRY(try_load_from_fd_and_close(fd, highdpi_icon_string)); VERIFY(bitmap->width() % scale_factor == 0); @@ -126,9 +125,7 @@ ErrorOr> Bitmap::try_load_from_file(String const& path, in return bitmap; } - int fd = open(path.characters(), O_RDONLY); - if (fd < 0) - return Error::from_errno(errno); + auto fd = TRY(Core::System::open(path, O_RDONLY)); return try_load_from_fd_and_close(fd, path); }