[OpenWrt-Devel] [PATCH 1/5] Fix stack overflow bug of uloop lua binding.
Xiongfei(Alex) GUO
xfguo at credosemi.com
Fri Jun 20 14:06:38 EDT 2014
Well, I agree with you about the api name.
And, since we have done this, the "fd:cancel" should be renamed to
"fd:delete" too.
The code is:
static const luaL_Reg ufd_m[] = {
{ "cancel", ul_ufd_delete },
{ NULL, NULL }
};
On Fri, Jun 20, 2014 at 7:40 PM, John Crispin <john at phrozen.org> wrote:
>
>
> On 20/06/2014 13:31, xfguo at credosemi.com wrote:
> > The static variable `state` in `lua/uloop.c` should be clean after
> > every callback.
> >
> > Signed-off-by: Xiongfei(Alex) Guo <xfguo at credosemi.com> ---
>
>
> Hi,
>
> just had a quick browse over the patches. looks good, the only nipick
> i have is this
>
> +static int ul_cancel(lua_State *L)
> +{
> + uloop_end();
> + return 1;
> +}
>
> can we rename is to ul_end() and then also fix up {"cancel",
> ul_cancel} to use end instead of cancel. that way the apis have the
> same names in lua and c. apart from that thanks for the patches, i
> will give them a try later on and then merge them into the git.
>
> John
>
>
>
>
>
>
>
>
>
>
>
> > lua/uloop.c | 2 ++ 1 file changed, 2 insertions(+)
> >
> > diff --git a/lua/uloop.c b/lua/uloop.c index 51f53c2..5922e04
> > 100644 --- a/lua/uloop.c +++ b/lua/uloop.c @@ -43,6 +43,7 @@ static
> > void ul_timer_cb(struct uloop_timeout *t)
> >
> > lua_getglobal(state, "__uloop_cb"); lua_rawgeti(state, -1,
> > tout->r); + lua_remove(state, -2); lua_call(state, 0, 0); }
> >
> > @@ -133,6 +134,7 @@ static void ul_process_cb(struct uloop_process
> > *p, int ret) lua_getglobal(state, "__uloop_cb"); lua_rawgeti(state,
> > -1, proc->r); luaL_unref(state, -2, proc->r); + lua_remove(state,
> > -2); lua_pushinteger(state, ret >> 8); lua_call(state, 1, 0); }
> >
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20140621/f1725c4d/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list