mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 19:24:14 +08:00
move to use io.CopyN
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
package readonly
|
package readonly
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -181,7 +182,8 @@ func (s *Node) Read(req *fuse.ReadRequest, resp *fuse.ReadResponse, intr fs.Intr
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil && err != io.EOF {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user