Skip to content

Commit

Permalink
handle lookup errors when connecting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ncopa committed Jun 16, 2023
1 parent 46422c4 commit 05ce554
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua-mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ static int mosq__pstatus(lua_State *L, int mosq_errno) {
lua_pushstring(L, strerror(errno));
return 3;
break;

default:
lua_pushnil(L);
lua_pushinteger(L, mosq_errno);
lua_pushstring(L, mosquitto_strerror(mosq_errno));
return 3;
break;
}

return 0;
Expand Down

0 comments on commit 05ce554

Please sign in to comment.