1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 08:47:35 +00:00

FileManager: Use Core::File::read_link()

This commit is contained in:
Sergey Bugaev 2020-06-16 22:02:35 +03:00 committed by Andreas Kling
parent 0674d9362b
commit 363b7351b8

View file

@ -117,12 +117,11 @@ PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, boo
properties.append({ "Location:", path }); properties.append({ "Location:", path });
if (S_ISLNK(m_mode)) { if (S_ISLNK(m_mode)) {
char link_destination[PATH_MAX]; auto link_destination = Core::File::read_link(path);
ssize_t len = readlink(path.characters(), link_destination, sizeof(link_destination)); if (link_destination.is_null()) {
if (len < 0) {
perror("readlink"); perror("readlink");
} else { } else {
properties.append({ "Link target:", String(link_destination, len) }); properties.append({ "Link target:", link_destination });
} }
} }