Only repair backups if repairing

This commit is contained in:
Dennis Schwerdel 2017-04-16 23:18:25 +02:00
parent 66e56b9b0c
commit 1617fecb92
2 changed files with 11 additions and 3 deletions

View File

@ -8,8 +8,10 @@ This project follows [semantic versioning](http://semver.org).
* [added] Added date to bundles
* [modified] Logging to stderr
* [modified] Enforce deterministic bundle ordering
* [modified] More info in analyze subcommand
* [fixed] Only print "repairing bundles" if actually repairing bundles
* [fixed] Only put mode bits of st_mode into metadata
* [fixed] Only repairing backups with --repair
### v0.2.0 (2017-04-14)

View File

@ -135,11 +135,13 @@ impl Repository {
*chunks = c;
modified = true;
},
Err(err) => {
Err(err) => if repair {
warn!("Problem detected: inode {:?} is corrupt\n\tcaused by: {}", path.join(name), err);
info!("Removing broken inode from backup");
removed.push(name.to_string());
modified = true;
} else {
return Err(err)
}
}
}
@ -185,9 +187,11 @@ impl Repository {
try!(self.evacuate_broken_backup(&name));
try!(self.save_backup(&backup, &name));
},
Err(err) => {
Err(err) => if repair {
warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err);
try!(self.evacuate_broken_backup(&name));
} else {
return Err(err)
}
}
Ok(())
@ -285,9 +289,11 @@ impl Repository {
try!(self.evacuate_broken_backup(&name));
try!(self.save_backup(&backup, &name));
},
Err(err) => {
Err(err) => if repair {
warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err);
try!(self.evacuate_broken_backup(&name));
} else {
return Err(err)
}
}
}