mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 03:58:21 +01:00
Fixe an issue with aux buffer init overwriting optional parameters in receive() (#334)
Fixes use on Lua >= 5.4.3
This commit is contained in:
parent
5b18e475f3
commit
d9cc531e3b
@ -103,11 +103,14 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
|
|||||||
* object:receive() interface
|
* object:receive() interface
|
||||||
\*-------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------*/
|
||||||
int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
||||||
int err = IO_DONE, top = lua_gettop(L);
|
int err = IO_DONE, top;
|
||||||
luaL_Buffer b;
|
luaL_Buffer b;
|
||||||
size_t size;
|
size_t size;
|
||||||
const char *part = luaL_optlstring(L, 3, "", &size);
|
const char *part = luaL_optlstring(L, 3, "", &size);
|
||||||
timeout_markstart(buf->tm);
|
timeout_markstart(buf->tm);
|
||||||
|
/* make sure we don't confuse buffer stuff with arguments */
|
||||||
|
lua_settop(L, 3);
|
||||||
|
top = lua_gettop(L);
|
||||||
/* initialize buffer with optional extra prefix
|
/* initialize buffer with optional extra prefix
|
||||||
* (useful for concatenating previous partial results) */
|
* (useful for concatenating previous partial results) */
|
||||||
luaL_buffinit(L, &b);
|
luaL_buffinit(L, &b);
|
||||||
|
Loading…
Reference in New Issue
Block a user