From df60d9f0684876fa74b882b086ca1205581f99cb Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 21 Aug 2021 16:33:35 +0200 Subject: Moved error handling out of buffer_grow --- stream.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'stream.c') diff --git a/stream.c b/stream.c index f7c75e0..9cf475e 100644 --- a/stream.c +++ b/stream.c @@ -225,7 +225,12 @@ int stream_write(lua_State * L) while (free_space < (int) data_length) { - buffer_grow(L, &s->out); + const int res = buffer_grow(&s->out); + if (-1 == res) + { + lua_pushstring(L, strerror(errno)); + return lua_error(L); + } free_space = s->out.allocated - s->out.length; } -- cgit v1.1