Mercurial > hg > nginx
diff src/core/nginx.c @ 5163:c0497468f521 stable-1.2
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 29 Mar 2013 18:18:42 +0000 |
parents | f1521859b8c2 |
children |
line wrap: on
line diff
--- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -637,7 +637,7 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, 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 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, 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\"",