tape: make sure we only commit/write valid catalogs

This commit is contained in:
Dietmar Maurer 2021-03-19 07:50:32 +01:00
parent 88bc9635aa
commit 82775c4764

View File

@ -313,6 +313,9 @@ impl MediaCatalog {
/// Conditionally commit if in pending data is large (> 1Mb) /// Conditionally commit if in pending data is large (> 1Mb)
pub fn commit_if_large(&mut self) -> Result<(), Error> { pub fn commit_if_large(&mut self) -> Result<(), Error> {
if self.current_archive.is_some() {
bail!("can't commit catalog in the middle of an chunk archive");
}
if self.pending.len() > 1024*1024 { if self.pending.len() > 1024*1024 {
self.commit()?; self.commit()?;
} }