浏览代码

Userland: Pledge wpath & cpath in strace

...while we open the output file.
Sergey Bugaev 4 年之前
父节点
当前提交
7f98aaa65a
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      Userland/Utilities/strace.cpp

+ 6 - 1
Userland/Utilities/strace.cpp

@@ -32,7 +32,7 @@ static void handle_sigint(int)
 
 int main(int argc, char** argv)
 {
-    if (pledge("stdio proc exec ptrace sigaction", nullptr) < 0) {
+    if (pledge("stdio wpath cpath proc exec ptrace sigaction", nullptr) < 0) {
         perror("pledge");
         return 1;
     }
@@ -60,6 +60,11 @@ int main(int argc, char** argv)
         trace_file = open_result.value();
     }
 
+    if (pledge("stdio proc exec ptrace sigaction", nullptr) < 0) {
+        perror("pledge");
+        return 1;
+    }
+
     int status;
     if (g_pid == -1) {
         if (child_argv.is_empty()) {