mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
improve some Negative_Read/Negative_Write logic
Returns the actual error if one is set, instead of swallowing it for the less descriptive negative error. Also fixes a out-of-bounds slice error in `bufio.writer_write` because it wasn't checking the returned `m`.
This commit is contained in:
@@ -95,6 +95,10 @@ writer_write :: proc(b: ^Writer, p: []byte) -> (n: int, err: io.Error) {
|
||||
m: int
|
||||
if writer_buffered(b) == 0 {
|
||||
m, b.err = io.write(b.wr, p)
|
||||
if m < 0 && b.err == nil {
|
||||
b.err = .Negative_Write
|
||||
break
|
||||
}
|
||||
} else {
|
||||
m = copy(b.buf[b.n:], p)
|
||||
b.n += m
|
||||
|
||||
Reference in New Issue
Block a user