diff src/os/unix/ngx_freebsd_sendfile_chain.c @ 264:cd009bf7400d

nginx-0.0.2-2004-02-19-19:48:14 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 19 Feb 2004 16:48:14 +0000
parents 8c5bdde0d9f0
children 6468241715e6
line wrap: on
line diff
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -118,30 +118,33 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(
             }
         }
 
-        /* create the tailer iovec and coalesce the neighbouring hunks */
-
-        prev = NULL;
-        iov = NULL;
+        if (file) {
+            /* create the tailer iovec and coalesce the neighbouring hunks */
 
-        for ( /* void */; cl && trailer.nelts < IOV_MAX; cl = cl->next) {
-            if (ngx_hunk_special(cl->hunk)) {
-                continue;
-            }
+            prev = NULL;
+            iov = NULL;
+
+            for ( /* void */; cl && trailer.nelts < IOV_MAX; cl = cl->next) {
+                if (ngx_hunk_special(cl->hunk)) {
+                    continue;
+                }
 
-            if (!ngx_hunk_in_memory_only(cl->hunk)) {
-                break;
-            }
+                if (!ngx_hunk_in_memory_only(cl->hunk)) {
+                    break;
+                }
 
-            if (prev == cl->hunk->pos) {
-                iov->iov_len += cl->hunk->last - cl->hunk->pos;
+                if (prev == cl->hunk->pos) {
+                    iov->iov_len += cl->hunk->last - cl->hunk->pos;
 
-            } else {
-                ngx_test_null(iov, ngx_push_array(&trailer), NGX_CHAIN_ERROR);
-                iov->iov_base = cl->hunk->pos;
-                iov->iov_len = cl->hunk->last - cl->hunk->pos;
+                } else {
+                    ngx_test_null(iov, ngx_push_array(&trailer),
+                                  NGX_CHAIN_ERROR);
+                    iov->iov_base = cl->hunk->pos;
+                    iov->iov_len = cl->hunk->last - cl->hunk->pos;
+                }
+
+                prev = cl->hunk->last;
             }
-
-            prev = cl->hunk->last;
         }
 
         /*