comparison src/core/ngx_cycle.c @ 4966:c821975c9068

Fixed handling of ngx_write_fd() and ngx_read_fd() errors. The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error, so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows platforms) might result in inaccurate error message in the error log. Also the ngx_errno global variable is being set only if the returned value is -1.
author Valentin Bartenev <vbart@nginx.com>
date Fri, 14 Dec 2012 15:24:24 +0000
parents 72e11139760b
children a0599b56e748
comparison
equal deleted inserted replaced
4965:58dfef910ccd 4966:c821975c9068
1143 1143
1144 if (file[i].buffer && len != 0) { 1144 if (file[i].buffer && len != 0) {
1145 1145
1146 n = ngx_write_fd(file[i].fd, file[i].buffer, len); 1146 n = ngx_write_fd(file[i].fd, file[i].buffer, len);
1147 1147
1148 if (n == NGX_FILE_ERROR) { 1148 if (n == -1) {
1149 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 1149 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
1150 ngx_write_fd_n " to \"%s\" failed", 1150 ngx_write_fd_n " to \"%s\" failed",
1151 file[i].name.data); 1151 file[i].name.data);
1152 1152
1153 } else if (n != len) { 1153 } else if (n != len) {