From 4b65ba27ec595840362978337e1d92d1eadf2ecf Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 13 Mar 2021 15:34:02 +0100 Subject: [PATCH] Terminal: Create config file parent directories before unveil()'ing Otherwise unveil() will fail, as even with "c" permissions the file's parent directory must exist. Fixes #5651. --- Userland/Applications/Terminal/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 96d0b39e239..d69ac2e3aac 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -347,6 +349,7 @@ int main(int argc, char** argv) } RefPtr config = Core::ConfigFile::get_for_app("Terminal"); + Core::File::ensure_parent_directories(config->file_name()); pid_t shell_pid = 0; @@ -502,7 +505,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "rwc")) { + if (unveil(config->file_name().characters(), "rwc") < 0) { perror("unveil"); return 1; }