From f1e83a57cd44e7b3eb5a0f22e062a0eb649bd0e7 Mon Sep 17 00:00:00 2001 From: Unrud Date: Tue, 22 Nov 2016 07:59:54 +0000 Subject: [PATCH] lib/osutil: Remove unnecessary fsync in Copy() Fsyncing the file has a small performance penalty and seems unnecessary. The file will be fsynced anyway, when the changes are commited to the database. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3749 --- lib/osutil/osutil.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/osutil/osutil.go b/lib/osutil/osutil.go index a2ab05c5..11193e08 100644 --- a/lib/osutil/osutil.go +++ b/lib/osutil/osutil.go @@ -172,10 +172,7 @@ func copyFileContents(src, dst string) (err error) { err = cerr } }() - if _, err = io.Copy(out, in); err != nil { - return - } - err = out.Sync() + _, err = io.Copy(out, in) return }