mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-02 15:15:17 +00:00
fix(userspace/falco): fix create_dir behaviour
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
This commit is contained in:
@@ -92,13 +92,15 @@ falco::app::run_result falco::app::actions::create_requested_paths(falco::app::s
|
|||||||
return run_result::ok();
|
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)
|
static int create_dir(const std::string &path)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::filesystem::path dirPath(path);
|
std::filesystem::path dirPath(path);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::filesystem::create_directories(dirPath);
|
std::filesystem::create_directories(dirPath.parent_path());
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user