]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: lua: return bad error messages
authorThierry FOURNIER <thierry.fournier@ozon.io>
Fri, 23 Feb 2018 17:41:18 +0000 (18:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Mar 2018 11:59:19 +0000 (12:59 +0100)
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]

src/hlua.c

index ebe8c92b1743bad4d8fdb623990e081dba5b0b4b..5c56dc0a9978dbf70e52dbdde7b616df9e4311c6 100644 (file)
@@ -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);