mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to ErrorOr<String>. The rest of the change is to support the potential of an Error being returned and subsequent release of the value when no Error is returned. Unfortunately at this stage none of the places affected can utililize our TRY() macro.
This commit is contained in:
committed by
Andreas Kling
parent
10093a6773
commit
4a57be824c
Notes:
sideshowbarker
2024-07-17 16:50:51 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/4a57be824c Pull-request: https://github.com/SerenityOS/serenity/pull/13215 Reviewed-by: https://github.com/awesomekling
@@ -61,7 +61,11 @@ bool FileSystemModel::Node::fetch_data(String const& full_path, bool is_root)
|
||||
mtime = st.st_mtime;
|
||||
|
||||
if (S_ISLNK(mode)) {
|
||||
symlink_target = Core::File::read_link(full_path);
|
||||
auto sym_link_target_or_error = Core::File::read_link(full_path);
|
||||
if (sym_link_target_or_error.is_error())
|
||||
perror("readlink");
|
||||
|
||||
symlink_target = sym_link_target_or_error.release_value();
|
||||
if (symlink_target.is_null())
|
||||
perror("readlink");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user