mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
lock: Ignore empty lock files
These may be left behind by backends which do not guarantee atomic uploads.
This commit is contained in:
parent
20ad14e362
commit
57acc769b4
1 changed files with 6 additions and 0 deletions
|
@ -360,6 +360,12 @@ func ForAllLocks(ctx context.Context, repo Repository, excludeID *ID, fn func(ID
|
||||||
if excludeID != nil && id.Equal(*excludeID) {
|
if excludeID != nil && id.Equal(*excludeID) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if size == 0 {
|
||||||
|
// Ignore empty lock files as some backends do not guarantee atomic uploads.
|
||||||
|
// These may leave empty files behind if an upload was interrupted between
|
||||||
|
// creating the file and writing its data.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
lock, err := LoadLock(ctx, repo, id)
|
lock, err := LoadLock(ctx, repo, id)
|
||||||
|
|
||||||
m.Lock()
|
m.Lock()
|
||||||
|
|
Loading…
Reference in a new issue