[file_collection] check for file closure in same_file

Fixes #908
This commit is contained in:
Timothy Stack 2021-09-07 23:07:34 -07:00
parent 86e84e1dab
commit b6b0578027
2 changed files with 3 additions and 2 deletions

View File

@ -65,7 +65,6 @@ void file_collection::close_files(const std::vector<std::shared_ptr<logfile>> &f
++iter;
}
}
} else {
this->fc_file_names.erase(lf->get_filename());
}
@ -157,7 +156,8 @@ struct same_file {
*/
bool operator()(const std::shared_ptr<logfile> &lf) const
{
return this->sf_stat.st_dev == lf->get_stat().st_dev &&
return !lf->is_closed() &&
this->sf_stat.st_dev == lf->get_stat().st_dev &&
this->sf_stat.st_ino == lf->get_stat().st_ino;
};

View File

@ -412,6 +412,7 @@ DISTCLEANFILES = \
hw2.txt \
reload_test.0 \
truncfile.0 \
ln.dbg \
logfile_append.0 \
logfile_changed.0 \
logfile_rollover.1.live \