snapshots/blockfile: use passed in dst in scratchGenerator

Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
This commit is contained in:
Cardy.Tang 2023-05-30 11:42:19 +08:00
parent 4b7145cfd3
commit 9702d4aeec

View File

@ -55,8 +55,7 @@ func WithScratchFile(src string) Opt {
return func(root string, config *SnapshotterConfig) { return func(root string, config *SnapshotterConfig) {
config.scratchGenerator = func(dst string) error { config.scratchGenerator = func(dst string) error {
// Copy src to dst // Copy src to dst
scratch := filepath.Join(root, "scratch") if err := fs.CopyFile(dst, src); err != nil {
if err := fs.CopyFile(scratch, src); err != nil {
return fmt.Errorf("failed to copy scratch: %w", err) return fmt.Errorf("failed to copy scratch: %w", err)
} }
return nil return nil