libs/nixio: fix possible issue with nonblocking bind()
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 11 Aug 2011 23:15:05 +0000 (23:15 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 11 Aug 2011 23:15:05 +0000 (23:15 +0000)
libs/nixio/src/bind.c
libs/nixio/src/nixio.c

index 81ab0bb..7112059 100644 (file)
@@ -180,7 +180,7 @@ static int nixio_sock__bind_connect(lua_State *L, int do_bind) {
                        }
 
                        /* on success */
-                       if (!status) {
+                       if (!status || errno == EINPROGRESS) {
                                break;
                        }
                }
index f6e8e18..70a77b4 100644 (file)
@@ -198,6 +198,8 @@ NIXIO_API int luaopen_nixio(lua_State *L) {
        NIXIO_PUSH_CONSTANT(SIGSEGV);
 
 #ifndef __WINNT__
+       NIXIO_PUSH_CONSTANT(EALREADY);
+       NIXIO_PUSH_CONSTANT(EINPROGRESS);
        NIXIO_PUSH_CONSTANT(EWOULDBLOCK);
        NIXIO_PUSH_CONSTANT(ELOOP);
        NIXIO_PUSH_CONSTANT(EOVERFLOW);