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 81ab0bb480037e42901fc5b2690cacb809b2cffb..711205955cd026e93ce078bffaf38feae3d8bc93 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 f6e8e184c0fa131cfdb9dff434da1ccd17da21b1..70a77b4c9be9987d7c2c2df5cac8a5902c719a8d 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);