mirror of
https://github.com/restic/restic.git
synced 2025-10-19 15:43:21 +00:00
backup: do not crash if nodeFromFileInfo fails
this could crash in two cases: - if a directory is deleted between restic stating it and trying to list its directory content. - when restic tries to list the parent directory of a backup target, but the parent directory has been deleted. return an error in this case instead.
This commit is contained in:
parent
49abea6952
commit
73995b818a
1 changed files with 5 additions and 0 deletions
|
@ -264,6 +264,11 @@ func (arch *Archiver) trackItem(item string, previous, current *restic.Node, s I
|
||||||
// nodeFromFileInfo returns the restic node from an os.FileInfo.
|
// nodeFromFileInfo returns the restic node from an os.FileInfo.
|
||||||
func (arch *Archiver) nodeFromFileInfo(snPath, filename string, meta ToNoder, ignoreXattrListError bool) (*restic.Node, error) {
|
func (arch *Archiver) nodeFromFileInfo(snPath, filename string, meta ToNoder, ignoreXattrListError bool) (*restic.Node, error) {
|
||||||
node, err := meta.ToNode(ignoreXattrListError)
|
node, err := meta.ToNode(ignoreXattrListError)
|
||||||
|
// node does not exist. This prevents all further processing for this file.
|
||||||
|
// If an error and a node are returned, then preserve as much data as possible (see below).
|
||||||
|
if err != nil && node == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if !arch.WithAtime {
|
if !arch.WithAtime {
|
||||||
node.AccessTime = node.ModTime
|
node.AccessTime = node.ModTime
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue