From: Thierry FOURNIER Date: Fri, 23 Feb 2018 17:41:18 +0000 (+0100) Subject: BUG/MINOR: lua: return bad error messages X-Git-Tag: v1.9-dev1~365 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd1e955a564f88226c335477d706dd94f25c8081;p=thirdparty%2Fhaproxy.git BUG/MINOR: lua: return bad error messages The returned type is the type of the top of stack value and not the type of the checked argument. [wt: this can be backported to 1.8, 1.7 and 1.6] --- diff --git a/src/hlua.c b/src/hlua.c index ebe8c92b17..5c56dc0a99 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -269,7 +269,7 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str __LJMP unsigned int hlua_checkfunction(lua_State *L, int argno) { if (!lua_isfunction(L, argno)) { - const char *msg = lua_pushfstring(L, "function expected, got %s", luaL_typename(L, -1)); + const char *msg = lua_pushfstring(L, "function expected, got %s", luaL_typename(L, argno)); WILL_LJMP(luaL_argerror(L, argno, msg)); } lua_pushvalue(L, argno);