2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-23 13:17:42 +00:00

backup: Use absolute paths for allowed devices

This commit is contained in:
Alexander Neumann 2018-05-11 21:31:13 +02:00
parent 18d4ac2fd9
commit ef7747313d

View File

@ -185,7 +185,11 @@ func isDirExcludedByFile(dir, tagFilename, header string) bool {
func gatherDevices(items []string) (deviceMap map[string]uint64, err error) {
deviceMap = make(map[string]uint64)
for _, item := range items {
item = filepath.Clean(item)
item, err = filepath.Abs(filepath.Clean(item))
if err != nil {
return nil, err
}
fi, err := fs.Lstat(item)
if err != nil {
return nil, err
@ -225,7 +229,7 @@ func rejectByDevice(samples []string) (RejectFunc, error) {
panic(err)
}
for dir := item; dir != ""; dir = filepath.Dir(dir) {
for dir := item; dir != filepath.Dir(dir); dir = filepath.Dir(dir) {
debug.Log("item %v, test dir %v", item, dir)
allowedID, ok := allowed[dir]