summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-01-28 16:23:59 +0300
committerAndreas Kling <kling@serenityos.org>2020-01-28 15:08:27 +0100
commitf9b4d981a8518974e31a4f79e83a7e06fa3f0fb5 (patch)
tree34b99ef241bea445c265483a47e86fa8c17f2e9f /Applications
parentf983dfe319978b47b4c5314df9ea3373e3d69c05 (diff)
downloadserenity-f9b4d981a8518974e31a4f79e83a7e06fa3f0fb5.zip
LibGUI+FileManager: Try better to detect executables
We will now consider a file to be an executable if any of the executable permission bits are set.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/FileManager/DirectoryView.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp
index a9391c7c3c..af5570f02d 100644
--- a/Applications/FileManager/DirectoryView.cpp
+++ b/Applications/FileManager/DirectoryView.cpp
@@ -68,8 +68,9 @@ void DirectoryView::handle_activation(const GModelIndex& index)
return;
}
- // FIXME: This doesn't seem like the right way to fully detect executability.
- if (st.st_mode & S_IXUSR) {
+ ASSERT(!S_ISLNK(st.st_mode));
+
+ if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
if (fork() == 0) {
int rc = execl(path.characters(), path.characters(), nullptr);
if (rc < 0)