aports/main/lua-mosquitto/0001-handle-lookup-errors-when-connecting.patch
Natanael Copa 49c91fa21f main/lua-mosquitto: fix error handling, fix lua5.4 install
Ensure that lua 5.4 module is installed in correct location.

Fix error handling, for lookup errors.
ref: https://github.com/flukso/lua-mosquitto/pull/37
2023-06-12 16:07:17 +02:00

49 lines
1.3 KiB
Diff

From d1e530459cb45b4aace4a3e7258e83dbefff93bb Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 12 Jun 2023 15:54:59 +0200
Subject: [PATCH] handle lookup errors when connecting
Connect may result in lookup error, which was not handled. Solve this by
use a default error handler which returns whatever mosquitto reports.
This prevents us from missing errors.
---
lua-mosquitto.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/lua-mosquitto.c b/lua-mosquitto.c
index 7f298bd..bae378d 100644
--- a/lua-mosquitto.c
+++ b/lua-mosquitto.c
@@ -99,21 +99,20 @@ static int mosq__pstatus(lua_State *L, int mosq_errno) {
return luaL_error(L, mosquitto_strerror(mosq_errno));
break;
- case MOSQ_ERR_NO_CONN:
- case MOSQ_ERR_CONN_LOST:
- case MOSQ_ERR_PAYLOAD_SIZE:
+ case MOSQ_ERR_ERRNO:
lua_pushnil(L);
- lua_pushinteger(L, mosq_errno);
- lua_pushstring(L, mosquitto_strerror(mosq_errno));
+ lua_pushinteger(L, errno);
+ lua_pushstring(L, strerror(errno));
return 3;
break;
- case MOSQ_ERR_ERRNO:
+ default:
lua_pushnil(L);
- lua_pushinteger(L, errno);
- lua_pushstring(L, strerror(errno));
+ lua_pushinteger(L, mosq_errno);
+ lua_pushstring(L, mosquitto_strerror(mosq_errno));
return 3;
break;
+
}
return 0;
--
2.41.0