Skip to content

Commit bda12ef

Browse files
committed
FDS output: make tmp suffix a constant
1 parent ede37d9 commit bda12ef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/plugins/output/fds/src/Storage.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <libgen.h>
1818
#include "Storage.hpp"
1919

20+
const std::string TMP_SUFFIX = ".tmp";
21+
2022
Storage::Storage(ipx_ctx_t *ctx, const Config &cfg) : m_ctx(ctx), m_path(cfg.m_path)
2123
{
2224
// Check if the directory exists
@@ -58,7 +60,7 @@ Storage::window_new(time_t ts)
5860
window_close();
5961

6062
// Open new file
61-
const std::string new_file = filename_gen(ts) + ".tmp";
63+
const std::string new_file = filename_gen(ts) + TMP_SUFFIX;
6264
m_file_name = new_file;
6365
std::unique_ptr<char, decltype(&free)> new_file_cpy(strdup(new_file.c_str()), &free);
6466

@@ -90,7 +92,7 @@ Storage::window_close()
9092
m_file.reset();
9193
m_session2params.clear();
9294
if (file_opened) {
93-
std::string new_file_name(m_file_name.begin(), m_file_name.end() - std::string(".tmp").size());
95+
std::string new_file_name(m_file_name.begin(), m_file_name.end() - TMP_SUFFIX.size());
9496
std::rename(m_file_name.c_str(), new_file_name.c_str());
9597
m_file_name.clear();
9698
}

0 commit comments

Comments
 (0)