Ignore symlinks with missing target, add better backup logging, update copyright year to 2021

This commit is contained in:
Matthew Penner
2020-12-27 12:54:18 -07:00
parent e75118e0f0
commit 640e30de8a
5 changed files with 43 additions and 14 deletions

View File

@@ -152,7 +152,12 @@ func (a *Archive) addToArchive(p string, rp string, w *tar.Writer) error {
if s.Mode()&os.ModeSymlink != 0 {
// Read the target of the symlink.
target, err = os.Readlink(s.Name())
if err != nil && !os.IsNotExist(err) {
if err != nil {
// Skip symlinks if the target does not exist.
if os.IsNotExist(err) {
return nil
}
return errors.WithMessagef(err, "failed to read symlink target for '%s'", rp)
}
}