vfs/splice: limit a size of an intermediate buffer to pipe.DefaultPipeSize

This commit is contained in:
Andrei Vagin
2021-12-08 12:17:16 -08:00
committed by Andrei Vagin
parent eeeaa63923
commit b660830fe8
+5 -1
View File
@@ -380,7 +380,11 @@ func Sendfile(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
}
} else {
// Read inFile to buffer, then write the contents to outFile.
buf := make([]byte, count)
bufSize := count
if count > pipe.DefaultPipeSize {
bufSize = count
}
buf := make([]byte, bufSize)
for {
var readN int64
if offset != -1 {