From 4a2dd5bf660fe177f7fdb3662c2a5b9a960b32c7 Mon Sep 17 00:00:00 2001 From: Anand Date: Thu, 20 May 2021 11:11:20 +0530 Subject: [PATCH] Inspector: Throw an error when inspecting a process it has no access to --- Userland/DevTools/Inspector/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index d0a0d643e98..fa63527c741 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -97,6 +97,11 @@ int main(int argc, char** argv) return 1; } + if (access(String::formatted("/proc/{}", pid).characters(), R_OK) == -1) { + GUI::MessageBox::show(window, "Inspector doesn't have permission to access the process.", "Error", GUI::MessageBox::Type::Error); + return 1; + } + window->set_title("Inspector"); window->resize(685, 500); window->set_icon(app_icon.bitmap_for_size(16));