From 09bd924710d436f4ad022710d0e8158ec949718f Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 20 Apr 2018 13:53:11 +0200 Subject: [PATCH] Do not restore sockets, correct error handling Closes #1730 --- internal/restic/restorer.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/restic/restorer.go b/internal/restic/restorer.go index 5f60e9d09..8c27988f2 100644 --- a/internal/restic/restorer.go +++ b/internal/restic/restorer.go @@ -76,6 +76,11 @@ func (res *Restorer) restoreTo(ctx context.Context, target, location string, tre continue } + // sockets cannot be restored + if node.Type == "socket" { + continue + } + selectedForRestore, childMayBeSelected := res.SelectFilter(nodeLocation, nodeTarget, node) debug.Log("SelectFilter returned %v %v", selectedForRestore, childMayBeSelected) @@ -96,14 +101,20 @@ func (res *Restorer) restoreTo(ctx context.Context, target, location string, tre if selectedForRestore { err = res.restoreNodeTo(ctx, node, nodeTarget, nodeLocation, idx) if err != nil { - return err + err = res.Error(nodeLocation, node, errors.Wrap(err, "restoreNodeTo")) + if err != nil { + return err + } } // Restore directory timestamp at the end. If we would do it earlier, restoring files within // the directory would overwrite the timestamp of the directory they are in. err = node.RestoreTimestamps(nodeTarget) if err != nil { - return err + err = res.Error(nodeLocation, node, errors.Wrap(err, "RestoreTimestamps")) + if err != nil { + return err + } } } }