# HG changeset patch # User jbe # Date 1428664277 -7200 # Node ID 84aa2b8dcf797b155d05d6c241f211b3e0374ae9 # Parent 118e320a7812cb2fe99b189b0c74f51527cbfd4f Fixed bug regarding testing of valid file descriptor in moonbr_child_run function diff -r 118e320a7812 -r 84aa2b8dcf79 moonbridge.c --- a/moonbridge.c Fri Apr 10 13:08:34 2015 +0200 +++ b/moonbridge.c Fri Apr 10 13:11:17 2015 +0200 @@ -841,9 +841,9 @@ } if (controlmsg == MOONBR_COMMAND_TERMINATE) break; listener = moonbr_child_receive_pointer(MOONBR_FD_CONTROL); - if (fd) moonbr_io_pushhandle(L, fd); + if (fd >= 0) moonbr_io_pushhandle(L, fd); lua_rawgetp(L, LUA_REGISTRYINDEX, moonbr_luakey_connect_func(pool)); - if (!fd) { + if (fd < 0) { lua_newtable(L); lua_pushstring(L, listener->proto_specific.interval.name ? @@ -857,7 +857,7 @@ fprintf(stderr, "Error in \"connect\" function: %s\n", lua_tostring(L, -1)); exit(1); } - if (fd) moonbr_io_closehandle(L, -2, 0); /* attemt clean close */ + if (fd >= 0) moonbr_io_closehandle(L, -2, 0); /* attemt clean close */ if (lua_type(L, -1) != LUA_TBOOLEAN || !lua_toboolean(L, -1)) break; #ifdef MOONBR_LUA_PANIC_BUG_WORKAROUND lua_settop(L, 2);