moonbridge
diff moonbridge.c @ 119:84aa2b8dcf79
Fixed bug regarding testing of valid file descriptor in moonbr_child_run function
author | jbe |
---|---|
date | Fri Apr 10 13:11:17 2015 +0200 (2015-04-10) |
parents | 7014436d88ea |
children | 61a2f55b3538 |
line diff
1.1 --- a/moonbridge.c Fri Apr 10 13:08:34 2015 +0200 1.2 +++ b/moonbridge.c Fri Apr 10 13:11:17 2015 +0200 1.3 @@ -841,9 +841,9 @@ 1.4 } 1.5 if (controlmsg == MOONBR_COMMAND_TERMINATE) break; 1.6 listener = moonbr_child_receive_pointer(MOONBR_FD_CONTROL); 1.7 - if (fd) moonbr_io_pushhandle(L, fd); 1.8 + if (fd >= 0) moonbr_io_pushhandle(L, fd); 1.9 lua_rawgetp(L, LUA_REGISTRYINDEX, moonbr_luakey_connect_func(pool)); 1.10 - if (!fd) { 1.11 + if (fd < 0) { 1.12 lua_newtable(L); 1.13 lua_pushstring(L, 1.14 listener->proto_specific.interval.name ? 1.15 @@ -857,7 +857,7 @@ 1.16 fprintf(stderr, "Error in \"connect\" function: %s\n", lua_tostring(L, -1)); 1.17 exit(1); 1.18 } 1.19 - if (fd) moonbr_io_closehandle(L, -2, 0); /* attemt clean close */ 1.20 + if (fd >= 0) moonbr_io_closehandle(L, -2, 0); /* attemt clean close */ 1.21 if (lua_type(L, -1) != LUA_TBOOLEAN || !lua_toboolean(L, -1)) break; 1.22 #ifdef MOONBR_LUA_PANIC_BUG_WORKAROUND 1.23 lua_settop(L, 2);