1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibCore: Make Core::File::open() return OSError in case of failure

This commit is contained in:
Andreas Kling 2021-08-20 11:16:42 +02:00
parent 1474a537b6
commit 13f4890c38
8 changed files with 15 additions and 15 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -27,11 +27,11 @@
namespace Core {
Result<NonnullRefPtr<File>, String> File::open(String filename, OpenMode mode, mode_t permissions)
Result<NonnullRefPtr<File>, OSError> File::open(String filename, OpenMode mode, mode_t permissions)
{
auto file = File::construct(move(filename));
if (!file->open_impl(mode, permissions))
return String(file->error_string());
return OSError(file->error());
return file;
}