From 0674d9362bf1ee08612ea73bff742ccbf80ea7c9 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Tue, 16 Jun 2020 22:02:17 +0300 Subject: [PATCH] LibGUI: Use Core::File::read_link() --- Libraries/LibGUI/FileSystemModel.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Libraries/LibGUI/FileSystemModel.cpp b/Libraries/LibGUI/FileSystemModel.cpp index 71ed505025..71ee61b09c 100644 --- a/Libraries/LibGUI/FileSystemModel.cpp +++ b/Libraries/LibGUI/FileSystemModel.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -73,14 +74,9 @@ bool FileSystemModel::Node::fetch_data(const String& full_path, bool is_root) mtime = st.st_mtime; if (S_ISLNK(mode)) { - char buffer[PATH_MAX]; - int length = readlink(full_path.characters(), buffer, sizeof(buffer)); - if (length < 0) { + symlink_target = Core::File::read_link(full_path); + if (symlink_target.is_null()) perror("readlink"); - } else { - ASSERT(length > 0); - symlink_target = String(buffer, length - 1); - } } return true;