aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-10-27 08:12:16 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-10-27 08:12:16 +0100
commit8d70c4a50198b18f2e16ab9ff58ca43df0d4ebd8 (patch)
tree0d33ea09100c81d077258b04a5042f164fa31e8a /src
parent1112ad8b30b0f5951d9fa553bea6072105284011 (diff)
downloadrspamd-8d70c4a50198b18f2e16ab9ff58ca43df0d4ebd8.tar.gz
rspamd-8d70c4a50198b18f2e16ab9ff58ca43df0d4ebd8.zip
[Fix] A workaround for brain-damaged std::filesystem behaviour
Issue: #4665
Diffstat (limited to 'src')
-rw-r--r--src/libserver/hyperscan_tools.cxx15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/libserver/hyperscan_tools.cxx b/src/libserver/hyperscan_tools.cxx
index dc0586107..f7bd78a9b 100644
--- a/src/libserver/hyperscan_tools.cxx
+++ b/src/libserver/hyperscan_tools.cxx
@@ -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;