From c8d825e1b34698ff37436d9482f0257fc9c231b1 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Thu, 7 Oct 2021 21:59:22 +0200 Subject: [PATCH] SpaceAnalyzer: Make files removable depending on directory permissions Prior this patch, you couldn't remove any files from the context menu if you didn't have write access to them. It was incorrect, as the write permission for files means that you can modify the contents of the file, where for directories it means that you can create, rename, and remove the files there. --- Userland/Applications/SpaceAnalyzer/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index f1411614b9..5afce1d11c 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -231,7 +231,7 @@ static void analyze(RefPtr tree, SpaceAnalyzer::TreeMapWidget& treemapwidg static bool is_removable(const String& absolute_path) { VERIFY(!absolute_path.is_empty()); - int access_result = access(absolute_path.characters(), W_OK); + int access_result = access(LexicalPath::dirname(absolute_path).characters(), W_OK); if (access_result != 0 && errno != EACCES) perror("access"); return access_result == 0;