[nginx] svn commit: r5047 - in branches/stable-1.2: . src/core

mdounin at mdounin.ru mdounin at mdounin.ru
Sun Feb 10 03:55:19 UTC 2013


Author: mdounin
Date: 2013-02-10 03:55:18 +0000 (Sun, 10 Feb 2013)
New Revision: 5047
URL: http://trac.nginx.org/nginx/changeset/5047/nginx

Log:
Merge of r4967: ngx_write_fd() and ngx_read_fd() errors handling.

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.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/core/ngx_conf_file.c
   branches/stable-1.2/src/core/ngx_cycle.c
   branches/stable-1.2/src/core/ngx_file.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2013-02-10 03:52:26 UTC (rev 5046)
+++ branches/stable-1.2	2013-02-10 03:55:18 UTC (rev 5047)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4966,4973,4978,4984,5011
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4967,4973,4978,4984,5011
\ No newline at end of property
Modified: branches/stable-1.2/src/core/ngx_conf_file.c
===================================================================
--- branches/stable-1.2/src/core/ngx_conf_file.c	2013-02-10 03:52:26 UTC (rev 5046)
+++ branches/stable-1.2/src/core/ngx_conf_file.c	2013-02-10 03:55:18 UTC (rev 5047)
@@ -983,7 +983,7 @@
 
         n = ngx_write_fd(file[i].fd, file[i].buffer, len);
 
-        if (n == NGX_FILE_ERROR) {
+        if (n == -1) {
             ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
                           ngx_write_fd_n " to \"%s\" failed",
                           file[i].name.data);

Modified: branches/stable-1.2/src/core/ngx_cycle.c
===================================================================
--- branches/stable-1.2/src/core/ngx_cycle.c	2013-02-10 03:52:26 UTC (rev 5046)
+++ branches/stable-1.2/src/core/ngx_cycle.c	2013-02-10 03:55:18 UTC (rev 5047)
@@ -1145,7 +1145,7 @@
 
             n = ngx_write_fd(file[i].fd, file[i].buffer, len);
 
-            if (n == NGX_FILE_ERROR) {
+            if (n == -1) {
                 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
                               ngx_write_fd_n " to \"%s\" failed",
                               file[i].name.data);

Modified: branches/stable-1.2/src/core/ngx_file.c
===================================================================
--- branches/stable-1.2/src/core/ngx_file.c	2013-02-10 03:52:26 UTC (rev 5046)
+++ branches/stable-1.2/src/core/ngx_file.c	2013-02-10 03:55:18 UTC (rev 5047)
@@ -732,14 +732,14 @@
 
         n = ngx_read_fd(fd, buf, len);
 
-        if (n == NGX_FILE_ERROR) {
+        if (n == -1) {
             ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
                           ngx_read_fd_n " \"%s\" failed", from);
             goto failed;
         }
 
         if ((size_t) n != len) {
-            ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+            ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
                           ngx_read_fd_n " has read only %z of %uz from %s",
                           n, size, from);
             goto failed;
@@ -747,14 +747,14 @@
 
         n = ngx_write_fd(nfd, buf, len);
 
-        if (n == NGX_FILE_ERROR) {
+        if (n == -1) {
             ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
                           ngx_write_fd_n " \"%s\" failed", to);
             goto failed;
         }
 
         if ((size_t) n != len) {
-            ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+            ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
                           ngx_write_fd_n " has written only %z of %uz to %s",
                           n, size, to);
             goto failed;



More information about the nginx-devel mailing list