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); }