mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00: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:
parent
10093a6773
commit
4a57be824c
12 changed files with 72 additions and 30 deletions
|
@ -81,7 +81,10 @@ TEST_CASE(test_change_file_location)
|
|||
ftruncate(fd, 0);
|
||||
EXPECT(fchmod(fd, 06755) != -1);
|
||||
|
||||
auto suid_path = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
auto suid_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
EXPECT(!suid_path_or_error.is_error());
|
||||
|
||||
auto suid_path = suid_path_or_error.release_value();
|
||||
EXPECT(suid_path.characters());
|
||||
auto new_path = String::formatted("{}.renamed", suid_path);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue