2
0

Fix: Handle (n > 0 and err == io.EOF) in CopyFromReader as per io.Reader documentation

This commit is contained in:
Fredrik Petrini
2018-10-08 11:39:18 +02:00
parent 0b00887bf8
commit c6cec81e2c
2 changed files with 94 additions and 1 deletions
+1 -1
View File
@@ -298,7 +298,7 @@ func (c *Conn) CopyFromReader(r io.Reader, sql string) error {
sp := len(buf)
for {
n, err := r.Read(buf[5:cap(buf)])
if err == io.EOF {
if err == io.EOF && n == 0 {
break
}
buf = buf[0 : n+5]