Skip to content

Commit ede37d9

Browse files
committed
FDS output: proper behavior on file open failure
1 parent 9d871c2 commit ede37d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ Storage::window_new(time_t ts)
8686
void
8787
Storage::window_close()
8888
{
89+
bool file_opened = (m_file.get() != nullptr);
8990
m_file.reset();
9091
m_session2params.clear();
91-
if (!m_file_name.empty()) {
92+
if (file_opened) {
9293
std::string new_file_name(m_file_name.begin(), m_file_name.end() - std::string(".tmp").size());
9394
std::rename(m_file_name.c_str(), new_file_name.c_str());
9495
m_file_name.clear();

0 commit comments

Comments
 (0)