summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/ls.cpp6
-rw-r--r--Userland/Utilities/readlink.cpp6
2 files changed, 7 insertions, 5 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)
diff --git a/Userland/Utilities/readlink.cpp b/Userland/Utilities/readlink.cpp
index 318e31ac1a..53c7a25d2d 100644
--- a/Userland/Utilities/readlink.cpp
+++ b/Userland/Utilities/readlink.cpp
@@ -25,11 +25,13 @@ int main(int argc, char** argv)
args_parser.parse(argc, argv);
for (const char* path : paths) {
- auto destination = Core::File::read_link(path);
- if (destination.is_null()) {
+ auto destination_or_error = Core::File::read_link(path);
+ if (destination_or_error.is_error()) {
perror(path);
return 1;
}
+
+ auto destination = destination_or_error.release_value();
out("{}", destination);
if (!no_newline)
outln();