aboutsummaryrefslogtreecommitdiff
path: root/core/bytes
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-04-25 19:08:48 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2024-04-25 19:08:48 +0200
commitd3bd1c211038d4cbc6eacfba642154282c48d845 (patch)
treea3fa0f684628142b22563820543654af646d04f9 /core/bytes
parente3d41f0a9ed106a0f0342fe8b166790965beb1b2 (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')
-rw-r--r--core/bytes/buffer.odin2
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
}