浏览代码

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
Unrud 9 年之前
父节点
当前提交
f1e83a57cd
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      lib/osutil/osutil.go

+ 1 - 4
lib/osutil/osutil.go

@@ -172,10 +172,7 @@ func copyFileContents(src, dst string) (err error) {
 			err = cerr
 			err = cerr
 		}
 		}
 	}()
 	}()
-	if _, err = io.Copy(out, in); err != nil {
-		return
-	}
-	err = out.Sync()
+	_, err = io.Copy(out, in)
 	return
 	return
 }
 }