1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +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 });
if (S_ISLNK(m_mode)) {
char link_destination[PATH_MAX];
ssize_t len = readlink(path.characters(), link_destination, sizeof(link_destination));
if (len < 0) {
auto link_destination = Core::File::read_link(path);
if (link_destination.is_null()) {
perror("readlink");
} else {
properties.append({ "Link target:", String(link_destination, len) });
properties.append({ "Link target:", link_destination });
}
}