2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-13 00:36:35 +00:00

ls: add missing read lock

As `ls` reads data from the repository, it must acquire a read lock
unless `--no-lock` was specified. The old behavior is equivalent to `ls
--no-lock`.
This commit is contained in:
Michael Eischer 2024-02-24 21:52:28 +01:00
parent dc441c57a7
commit d18726cd70

View File

@ -309,10 +309,11 @@ func runLs(ctx context.Context, opts LsOptions, gopts GlobalOptions, args []stri
return false
}
repo, err := OpenRepository(ctx, gopts)
ctx, repo, unlock, err := openWithReadLock(ctx, gopts, gopts.NoLock)
if err != nil {
return err
}
defer unlock()
snapshotLister, err := restic.MemorizeList(ctx, repo, restic.SnapshotFile)
if err != nil {