[dev] ngx_write_chain_to_temp_file and NGX_AGAIN

Manlio Perillo manlio.perillo at gmail.com
Tue Nov 27 21:08:31 MSK 2007


Hi.

I'm reading the code for writing a temporary buffer in a temporary file, 
and I have noted something not very clear.

Here is the code (core/ngx_file.c):
ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
{
     ngx_int_t  rc;

     if (tf->file.fd == NGX_INVALID_FILE) {
         rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
                                   tf->persistent, tf->clean,
                                   tf->access);

         if (rc == NGX_ERROR || rc == NGX_AGAIN) {
             return rc;
         }



However it seems that ngx_create_temp_file never returns NGX_AGAIN.

Moreover the functions ngx_event_pipe_write_chain_to_temp_file 
(event/ngx_event_pipe.c) and ngx_http_write_request_body 
(http/ngx_http_request_body) only check for NGX_ERROR and not for NGX_AGAIN.

So, should I check for NGX_ERROR only?



Thanks  Manlio Perillo





More information about the nginx mailing list