1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Fix writing miscellaneous bytes after EOF

This commit is contained in:
Andreas Baulig 2021-08-18 20:56:32 +00:00
parent 7472b754bf
commit d158c2776e
No known key found for this signature in database
GPG Key ID: 5225DCE5A4A2EE20

View File

@ -84,18 +84,15 @@ func copyContent(reader *bufio.Reader, writer *bufio.Writer, blockSize uint) {
for {
n, err := reader.Read(p)
if err != nil {
if err == nil || err == io.EOF {
writer.Write(p[0:n])
sz += int64(n)
if err == io.EOF {
writer.Write(p[0:n])
sz += int64(n)
break
} else {
fmt.Println("An error occurred during content copy. Aborting")
break
}
} else {
writer.Write(p)
sz += int64(blockSize) * 4096
fmt.Println("An error occurred during content copy. Aborting")
break
}
fmt.Printf("Wrote %d bytes\r", sz)