Fix restic backup --one-file-system /

This patch should fix the following panic when trying to backup the
root filesystem with thre --one-file-system flag:

    % restic backup --one-file-system /
    (...)
    panic: item /, device id 2082 not found, allowedDevs: map[/:2082]
This commit is contained in:
Mikael Berthe 2018-05-16 13:44:14 +02:00
parent 347a645450
commit a868a30f4d
1 changed files with 4 additions and 1 deletions

View File

@ -229,11 +229,14 @@ func rejectByDevice(samples []string) (RejectFunc, error) {
panic(err)
}
for dir := item; dir != filepath.Dir(dir); dir = filepath.Dir(dir) {
for dir := item; ; dir = filepath.Dir(dir) {
debug.Log("item %v, test dir %v", item, dir)
allowedID, ok := allowed[dir]
if !ok {
if dir == filepath.Dir(dir) {
break
}
continue
}