From d3f69233d5ed108f078e5817c80eda76470b4090 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Mon, 6 Nov 2023 18:52:19 +0000 Subject: [PATCH] fix(userspace/falco): fix create_dir behaviour Signed-off-by: Roberto Scolaro --- userspace/falco/app/actions/create_requested_paths.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/userspace/falco/app/actions/create_requested_paths.cpp b/userspace/falco/app/actions/create_requested_paths.cpp index 4c44eb84345..eae3815421e 100644 --- a/userspace/falco/app/actions/create_requested_paths.cpp +++ b/userspace/falco/app/actions/create_requested_paths.cpp @@ -92,13 +92,15 @@ falco::app::run_result falco::app::actions::create_requested_paths(falco::app::s return run_result::ok(); } +// This function operates like `mkdir -p` excluding the last part of +// the path which we assume to be the filename. static int create_dir(const std::string &path) { std::filesystem::path dirPath(path); try { - std::filesystem::create_directories(dirPath); + std::filesystem::create_directories(dirPath.parent_path()); } catch (const std::exception& ex) { return -1; }