From: Karl Fleischmann Date: Wed, 21 May 2025 09:42:16 +0000 (+0200) Subject: lib-lua/dlua-iostream: dlua_i_read_common() - Optimize error handling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4bd9f133b7df7a9da61aa88470071876411a42a1;p=thirdparty%2Fdovecot%2Fcore.git lib-lua/dlua-iostream: dlua_i_read_common() - Optimize error handling This also makes the error handling more explicit. --- diff --git a/src/lib-lua/dlua-iostream.c b/src/lib-lua/dlua-iostream.c index af1e0a6287..2b1bb2caa1 100644 --- a/src/lib-lua/dlua-iostream.c +++ b/src/lib-lua/dlua-iostream.c @@ -189,9 +189,12 @@ static int dlua_i_read_common(lua_State *L, struct dlua_iostream *stream, int fi int nargs = lua_gettop(L) - 1; bool success; int n; - (void)i_stream_read(stream->is); - if (nargs == 0) { + if (i_stream_read(stream->is) < 0 && + stream->is->stream_errno != 0) { + /* Skip to error handling. */ + success = FALSE; + } else if (nargs == 0) { success = dlua_read_line(L, stream, TRUE); n = first + 1; } else {