nginx-0.0.1-2003-10-30-19:51:33 import
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 5818636..60d68a0 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -741,7 +741,7 @@
     }
 
     bufs->size = ngx_parse_size(&value[2]);
-    if (bufs->size == NGX_ERROR || bufs->size == 0) {
+    if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) {
         return "invalid value";
     }
 
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index 3799cef..de57a5d 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -115,7 +115,7 @@
     *out = NULL;
 
     while (*busy) {
-        if (ngx_hunk_size((*busy)->hunk) > 0) {
+        if (ngx_hunk_size((*busy)->hunk) != 0) {
             break;
         }
 
diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h
index 3de78aa..e68ba6d 100644
--- a/src/core/ngx_hunk.h
+++ b/src/core/ngx_hunk.h
@@ -67,7 +67,7 @@
 
 typedef struct {
     int          num;
-    ssize_t      size;
+    size_t       size;
 } ngx_bufs_t;
 
 
@@ -117,8 +117,8 @@
 
 
 #define ngx_hunk_size(h)                                                     \
-        ((h->type & NGX_HUNK_IN_MEMORY) ? h->last - h->pos:                  \
-                                         (size_t) (h->file_last - h->file_pos))
+        ((h->type & NGX_HUNK_IN_MEMORY) ? (size_t) (h->last - h->pos):       \
+                                          (size_t) (h->file_last - h->file_pos))
 
 
 ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size);
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index b50cf90..69ed5bc 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -16,7 +16,8 @@
 int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
 {
     int           rc, last;
-    ssize_t       size, hsize;
+    size_t        hsize;
+    ssize_t       size;
     ngx_chain_t  *cl, *out, **last_out;
 
     /*
diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c
index c21abde..d652ac2 100644
--- a/src/event/modules/ngx_devpoll_module.c
+++ b/src/event/modules/ngx_devpoll_module.c
@@ -41,7 +41,7 @@
 static void *ngx_devpoll_create_conf(ngx_cycle_t *cycle);
 static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf);
 
-static int              dp;
+static int              dp = -1;
 static struct pollfd   *change_list, *event_list;
 static u_int            nchanges, max_changes, nevents;
 
diff --git a/src/event/ngx_event_connect.c b/src/event/ngx_event_connect.c
index c697c1b..e42efb8 100644
--- a/src/event/ngx_event_connect.c
+++ b/src/event/ngx_event_connect.c
@@ -203,16 +203,32 @@
     }
 
     if (ngx_event_flags & NGX_USE_AIO_EVENT) {
-        /* aio, iocp */
- 
-#if 1
-        /* TODO: NGX_EINPROGRESS */
 
+        /* aio, iocp */
+
+        if (ngx_blocking(s) == -1) {
+            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
+                          ngx_blocking_n " failed");
+
+            if (ngx_close_socket(s) == -1) {
+                ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
+                              ngx_close_socket_n " failed");
+            }
+
+            return NGX_ERROR;
+        }
+
+        /*
+         * aio allows to post operation on non-connected socket
+         * at least in FreeBSD
+         * 
+         * TODO: check in Win32, etc.
+         */
+ 
         rev->ready = 1;
         wev->ready = 1;
 
         return NGX_OK;
-#endif
     }
 
     /* TODO: epoll */
diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h
index 43423aa..f94936d 100644
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -9,6 +9,7 @@
 #define _FILE_OFFSET_BITS  64   /* must be before sys/types.h */
 
 #include <unistd.h>
+#include <inttypes.h>
 #include <stddef.h>             /* offsetof */
 #include <stdlib.h>
 #include <stdarg.h>