mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
FileManager: Fix asserts on checking properties of symlinks
There were two issues with this code: - The result of the readlink() call was checked incorrectly for errors. - This code shouldn't return because otherwise it leaves the GUI buttons uninitialized below, causing RefPtr asserts to trigger when the dialog tries to access the buttons later on.
This commit is contained in:
parent
85eb1d26d5
commit
c982bfee7e
Notes:
sideshowbarker
2024-07-19 08:53:18 +09:00
Author: https://github.com/xTibor Commit: https://github.com/SerenityOS/serenity/commit/c982bfee7e9 Pull-request: https://github.com/SerenityOS/serenity/pull/1352
1 changed files with 3 additions and 4 deletions
|
@ -107,12 +107,11 @@ PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, boo
|
|||
|
||||
if (S_ISLNK(m_mode)) {
|
||||
char link_destination[PATH_MAX];
|
||||
if (readlink(path.characters(), link_destination, sizeof(link_destination))) {
|
||||
if (readlink(path.characters(), link_destination, sizeof(link_destination)) < 0) {
|
||||
perror("readlink");
|
||||
return;
|
||||
} else {
|
||||
properties.append({ "Link target:", link_destination });
|
||||
}
|
||||
|
||||
properties.append({ "Link target:", link_destination });
|
||||
}
|
||||
|
||||
properties.append({ "Size:", String::format("%zu bytes", st.st_size) });
|
||||
|
|
Loading…
Reference in a new issue