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; }