[nginx] svn commit: r5164 - in branches/stable-1.2: . src/core src/os/unix
mdounin at mdounin.ru
mdounin at mdounin.ru
Fri Mar 29 18:18:44 UTC 2013
Author: mdounin
Date: 2013-03-29 18:18:42 +0000 (Fri, 29 Mar 2013)
New Revision: 5164
URL: http://trac.nginx.org/nginx/changeset/5164/nginx
Log:
Merge of r5138: use of NGX_FILE_ERROR.
Use NGX_FILE_ERROR for handling file operations errors.
On Win32 platforms 0 is used to indicate errors in file operations, so
comparing against either -1 or NGX_OK is not portable.
This was not much of an issue in patched code, since only ngx_fd_info() test
is actually reachable on Win32 and in worst case it might result in bogus
error log entry.
Patch by Piotr Sikora.
Modified:
branches/stable-1.2/
branches/stable-1.2/src/core/nginx.c
branches/stable-1.2/src/core/ngx_conf_file.c
branches/stable-1.2/src/core/ngx_connection.c
branches/stable-1.2/src/core/ngx_cycle.c
branches/stable-1.2/src/os/unix/ngx_process_cycle.c
Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2 2013-03-29 18:16:27 UTC (rev 5163)
+++ branches/stable-1.2 2013-03-29 18:18:42 UTC (rev 5164)
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-4969,4973-4974,4976-4994,4997,4999-5005,5011-5025,5027-5031,5066,5070-5071,5078,5082-5083,5098,5109,5113-5114,5117,5123,5127-5134
+/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-4969,4973-4974,4976-4994,4997,4999-5005,5011-5025,5027-5031,5066,5070-5071,5078,5082-5083,5098,5109,5113-5114,5117,5123,5127-5134,5138
\ No newline at end of property
Modified: branches/stable-1.2/src/core/nginx.c
===================================================================
--- branches/stable-1.2/src/core/nginx.c 2013-03-29 18:16:27 UTC (rev 5163)
+++ branches/stable-1.2/src/core/nginx.c 2013-03-29 18:18:42 UTC (rev 5164)
@@ -637,7 +637,7 @@
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
- if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) != NGX_OK) {
+ if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
ngx_rename_file_n " %s to %s failed "
"before executing new binary process \"%s\"",
@@ -652,7 +652,9 @@
pid = ngx_execute(cycle, &ctx);
if (pid == NGX_INVALID_PID) {
- if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data) != NGX_OK) {
+ if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data)
+ == NGX_FILE_ERROR)
+ {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
ngx_rename_file_n " %s back to %s failed after "
"an attempt to execute new binary process \"%s\"",
Modified: branches/stable-1.2/src/core/ngx_conf_file.c
===================================================================
--- branches/stable-1.2/src/core/ngx_conf_file.c 2013-03-29 18:16:27 UTC (rev 5163)
+++ branches/stable-1.2/src/core/ngx_conf_file.c 2013-03-29 18:18:42 UTC (rev 5164)
@@ -133,7 +133,7 @@
cf->conf_file = &conf_file;
- if (ngx_fd_info(fd, &cf->conf_file->file.info) == -1) {
+ if (ngx_fd_info(fd, &cf->conf_file->file.info) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
ngx_fd_info_n " \"%s\" failed", filename->data);
}
Modified: branches/stable-1.2/src/core/ngx_connection.c
===================================================================
--- branches/stable-1.2/src/core/ngx_connection.c 2013-03-29 18:16:27 UTC (rev 5163)
+++ branches/stable-1.2/src/core/ngx_connection.c 2013-03-29 18:18:42 UTC (rev 5164)
@@ -412,7 +412,7 @@
}
if (ngx_test_config) {
- if (ngx_delete_file(name) == -1) {
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
ngx_delete_file_n " %s failed", name);
}
@@ -739,7 +739,7 @@
{
u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1;
- if (ngx_delete_file(name) == -1) {
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
ngx_delete_file_n " %s failed", name);
}
Modified: branches/stable-1.2/src/core/ngx_cycle.c
===================================================================
--- branches/stable-1.2/src/core/ngx_cycle.c 2013-03-29 18:16:27 UTC (rev 5163)
+++ branches/stable-1.2/src/core/ngx_cycle.c 2013-03-29 18:18:42 UTC (rev 5164)
@@ -679,7 +679,7 @@
ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
"deleting socket %s", name);
- if (ngx_delete_file(name) == -1) {
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
ngx_delete_file_n " %s failed", name);
}
Modified: branches/stable-1.2/src/os/unix/ngx_process_cycle.c
===================================================================
--- branches/stable-1.2/src/os/unix/ngx_process_cycle.c 2013-03-29 18:16:27 UTC (rev 5163)
+++ branches/stable-1.2/src/os/unix/ngx_process_cycle.c 2013-03-29 18:18:42 UTC (rev 5164)
@@ -647,7 +647,7 @@
if (ngx_rename_file((char *) ccf->oldpid.data,
(char *) ccf->pid.data)
- != NGX_OK)
+ == NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
ngx_rename_file_n " %s back to %s failed "
More information about the nginx-devel
mailing list