Browse Source

[Fix] A workaround for brain-damaged std::filesystem behaviour

Issue: #4665
tags/3.7.3
Vsevolod Stakhov 7 months ago
parent
commit
8d70c4a501
No account linked to committer's email address
1 changed files with 2 additions and 13 deletions
  1. 2
    13
      src/libserver/hyperscan_tools.cxx

+ 2
- 13
src/libserver/hyperscan_tools.cxx View File

@@ -147,22 +147,11 @@ public:

fpath = std::filesystem::canonical(fpath, ec);

if (!ec) {
if (!ec && ec.value() != 0) {
msg_err_hyperscan("invalid path: \"%s\", error message: %s", fname, ec.message().c_str());
return;
}

if (fpath.empty()) {
msg_err_hyperscan("attempt to add an empty hyperscan file!");
return;
}

if (!std::filesystem::exists(fpath)) {
msg_err_hyperscan("attempt to add non existing hyperscan file: %s, %s", fpath.c_str(),
strerror(errno));
return;
}

auto dir = fpath.parent_path();
auto ext = fpath.extension();

@@ -188,7 +177,7 @@ public:

fpath = std::filesystem::canonical(fpath, ec);

if (!ec) {
if (!ec && ec.value() != 0) {
msg_err_hyperscan("invalid path to remove: \"%s\", error message: %s",
fname, ec.message().c_str());
return;

Loading…
Cancel
Save