forked from TrueCloudLab/restic
snapshot: correct error handling for filepath.Abs
This commit is contained in:
parent
0532f08048
commit
4e0b2a8e3a
2 changed files with 8 additions and 1 deletions
|
@ -692,6 +692,13 @@ func (arch *Archiver) Snapshot(ctx context.Context, p *restic.Progress, paths, t
|
||||||
}
|
}
|
||||||
sn.Excludes = arch.Excludes
|
sn.Excludes = arch.Excludes
|
||||||
|
|
||||||
|
// make paths absolute
|
||||||
|
for i, path := range paths {
|
||||||
|
if p, err := filepath.Abs(path); err == nil {
|
||||||
|
paths[i] = p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
jobs := archivePipe{}
|
jobs := archivePipe{}
|
||||||
|
|
||||||
// use parent snapshot (if some was given)
|
// use parent snapshot (if some was given)
|
||||||
|
|
|
@ -31,7 +31,7 @@ type Snapshot struct {
|
||||||
// time.
|
// time.
|
||||||
func NewSnapshot(paths []string, tags []string, hostname string, time time.Time) (*Snapshot, error) {
|
func NewSnapshot(paths []string, tags []string, hostname string, time time.Time) (*Snapshot, error) {
|
||||||
for i, path := range paths {
|
for i, path := range paths {
|
||||||
if p, err := filepath.Abs(path); err != nil {
|
if p, err := filepath.Abs(path); err == nil {
|
||||||
paths[i] = p
|
paths[i] = p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue