summaryrefslogtreecommitdiffstats
path: root/src/libutil/cxx
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-05-02 20:13:56 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-05-02 20:13:56 +0100
commit89f17f72d353f89cbf78d9a8bfcaa1d445519f73 (patch)
tree714bcd04a27624c8bdbb48b379fba510092f06ef /src/libutil/cxx
parent1e294ebb7bfcb43e3cecc89f6281366cd191b59d (diff)
downloadrspamd-89f17f72d353f89cbf78d9a8bfcaa1d445519f73.tar.gz
rspamd-89f17f72d353f89cbf78d9a8bfcaa1d445519f73.zip
[Minor] Fix empty cache filename case
Diffstat (limited to 'src/libutil/cxx')
-rw-r--r--src/libutil/cxx/locked_file.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libutil/cxx/locked_file.cxx b/src/libutil/cxx/locked_file.cxx
index 13406c6cf..6abc4a1b0 100644
--- a/src/libutil/cxx/locked_file.cxx
+++ b/src/libutil/cxx/locked_file.cxx
@@ -176,6 +176,10 @@ raii_mmaped_locked_file::raii_mmaped_locked_file(raii_mmaped_locked_file &&other
auto raii_file_sink::create(const char *fname, int flags, int perms,
const char *suffix) -> tl::expected<raii_file_sink, std::string>
{
+ if (!fname || !suffix) {
+ return tl::make_unexpected("cannot create file sink: bad input arguments");
+ }
+
auto tmp_fname = fmt::format("{}.{}", fname, suffix);
auto file = raii_locked_file::create(tmp_fname.c_str(), flags, perms);