summaryrefslogtreecommitdiff
path: root/Userland/Utilities/ls.cpp
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2022-03-23 16:36:03 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-24 11:57:51 +0100
commit4a57be824cc6d4fed95f182431ba807b2327395e (patch)
tree6f0185eb39bbf6cd199d30decd63bdbae655c3bb /Userland/Utilities/ls.cpp
parent10093a67732431924fc76145443ffac157b50e01 (diff)
downloadserenity-4a57be824cc6d4fed95f182431ba807b2327395e.zip
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.
Diffstat (limited to 'Userland/Utilities/ls.cpp')
-rw-r--r--Userland/Utilities/ls.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Utilities/ls.cpp b/Userland/Utilities/ls.cpp
index 30fa3a9a96..be1b551cb5 100644
--- a/Userland/Utilities/ls.cpp
+++ b/Userland/Utilities/ls.cpp
@@ -275,11 +275,11 @@ static size_t print_name(const struct stat& st, const String& name, const char*
}
if (S_ISLNK(st.st_mode)) {
if (path_for_link_resolution) {
- auto link_destination = Core::File::read_link(path_for_link_resolution);
- if (link_destination.is_null()) {
+ auto link_destination_or_error = Core::File::read_link(path_for_link_resolution);
+ if (link_destination_or_error.is_error()) {
perror("readlink");
} else {
- nprinted += printf(" -> ") + print_escaped(link_destination.characters());
+ nprinted += printf(" -> ") + print_escaped(link_destination_or_error.value().characters());
}
} else {
if (flag_classify)