summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2023-03-21 22:46:03 -0400
committerAndreas Kling <kling@serenityos.org>2023-03-22 09:06:38 +0100
commit832478ad0c1615fa3713e7839f7648df0b44fbee (patch)
tree547b2066228868c0c2e6c5e93aeddf2ba24c0ac5
parent34007790477ad58cf927b994f8a4cfeffa4cd4e2 (diff)
downloadserenity-832478ad0c1615fa3713e7839f7648df0b44fbee.zip
LibFileSystemAccessClient: Don't make illegal operation on files
`handle_prompt_end` is calling `is_device` and `is_directory` on the path chosen by the user. However, this path is not necessarily unveiled. Meaning that it the both functions results in an illegal operation. This is a regression introduced with the usage of LibFileSystem in 1d24f394. This patch, revert the behavior at its previous state, i.e. calling both functions with the fd provided by the FSAS.
-rw-r--r--Userland/Libraries/LibFileSystemAccessClient/Client.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp
index ea4af7a457..cd362c60f5 100644
--- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp
+++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp
@@ -129,13 +129,13 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co
return;
}
- if (FileSystem::is_device(*chosen_file)) {
+ if (FileSystem::is_device(ipc_file->fd())) {
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open device files", *chosen_file));
request_data.promise->resolve(Error::from_string_literal("Cannot open device files")).release_value_but_fixme_should_propagate_errors();
return;
}
- if (FileSystem::is_directory(*chosen_file)) {
+ if (FileSystem::is_directory(ipc_file->fd())) {
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open directory", *chosen_file));
request_data.promise->resolve(Error::from_errno(EISDIR)).release_value_but_fixme_should_propagate_errors();
return;