1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 18:13:54 +08:00

move to use io.CopyN

This commit is contained in:
Jeromy
2015-02-23 19:29:02 -08:00
parent a77ea2f0c8
commit c88340b5a4

View File

@ -5,6 +5,7 @@
package readonly
import (
"bytes"
"io"
"os"
@ -181,7 +182,8 @@ func (s *Node) Read(req *fuse.ReadRequest, resp *fuse.ReadResponse, intr fs.Intr
if err != nil {
return err
}
n, err := r.Read(resp.Data[:req.Size])
buf := bytes.NewBuffer(resp.Data)
n, err := io.CopyN(buf, r, int64(req.Size))
if err != nil && err != io.EOF {
return err
}