From 6fb0de62a4e1c16eb3ad7839c391354d33c93721 Mon Sep 17 00:00:00 2001
From: alingse <alingse@foxmail.com>
Date: Fri, 4 Apr 2025 22:21:45 +0800
Subject: [PATCH] operations: fix call fmt.Errorf with wrong err

---
 fs/operations/multithread.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/operations/multithread.go b/fs/operations/multithread.go
index 4f27d6b43..d6753eb14 100644
--- a/fs/operations/multithread.go
+++ b/fs/operations/multithread.go
@@ -312,8 +312,8 @@ func (w *writerAtChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, r
 	// if we were buffering, flush to disk
 	switch w := writer.(type) {
 	case *bufio.Writer:
-		er2 := w.Flush()
-		if er2 != nil {
+		err = w.Flush()
+		if err != nil {
 			return -1, fmt.Errorf("multi-thread copy: flush failed: %w", err)
 		}
 	}