From 9895a5c677489e3c09b08ce013f29a33d6fe3d16 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Thu, 22 Sep 2022 23:20:21 -0700 Subject: [PATCH] Improve copy function error checking + delete make fuzz because of https://github.com/golang/go/issues/52569 --- Makefile | 3 --- client/lib/lib.go | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1261af1..56928e6 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,6 @@ forcetest: test: HISHTORY_TEST=1 go test -p 1 ./... -fuzz: - HISHTORY_TEST=1 go test -p 1 -fuzz=FuzzTestMultipleUsers -run FuzzTestMultipleUsers client/client_test.go - acttest: act push -j test -e .github/push_event.json --reuse --container-architecture linux/amd64 diff --git a/client/lib/lib.go b/client/lib/lib.go index 5c87067..285f0c8 100644 --- a/client/lib/lib.go +++ b/client/lib/lib.go @@ -634,9 +634,13 @@ func copyFile(src, dst string) error { if err != nil { return err } - defer destination.Close() + _, err = io.Copy(destination, source) - return err + if err != nil { + return err + } + + return destination.Close() } func GetDownloadData() (shared.UpdateInfo, error) {