diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-04-25 19:08:48 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-04-25 19:08:48 +0200 |
| commit | d3bd1c211038d4cbc6eacfba642154282c48d845 (patch) | |
| tree | a3fa0f684628142b22563820543654af646d04f9 /core/bytes/buffer.odin | |
| parent | e3d41f0a9ed106a0f0342fe8b166790965beb1b2 (diff) | |
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`.
Diffstat (limited to 'core/bytes/buffer.odin')
| -rw-r--r-- | core/bytes/buffer.odin | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/bytes/buffer.odin b/core/bytes/buffer.odin index abfee6f2f..cb2ef9c62 100644 --- a/core/bytes/buffer.odin +++ b/core/bytes/buffer.odin @@ -359,7 +359,7 @@ buffer_read_from :: proc(b: ^Buffer, r: io.Reader) -> (n: i64, err: io.Error) #n resize(&b.buf, i) m, e := io.read(r, b.buf[i:cap(b.buf)]) if m < 0 { - err = .Negative_Read + err = e if e != nil else .Negative_Read return } |