comparison 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
comparison
equal deleted inserted replaced
5162:ee9a043765ea 5163:c0497468f521
635 635
636 ctx.envp = (char *const *) env; 636 ctx.envp = (char *const *) env;
637 637
638 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); 638 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
639 639
640 if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) != NGX_OK) { 640 if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) == NGX_FILE_ERROR) {
641 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 641 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
642 ngx_rename_file_n " %s to %s failed " 642 ngx_rename_file_n " %s to %s failed "
643 "before executing new binary process \"%s\"", 643 "before executing new binary process \"%s\"",
644 ccf->pid.data, ccf->oldpid.data, argv[0]); 644 ccf->pid.data, ccf->oldpid.data, argv[0]);
645 645
650 } 650 }
651 651
652 pid = ngx_execute(cycle, &ctx); 652 pid = ngx_execute(cycle, &ctx);
653 653
654 if (pid == NGX_INVALID_PID) { 654 if (pid == NGX_INVALID_PID) {
655 if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data) != NGX_OK) { 655 if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data)
656 == NGX_FILE_ERROR)
657 {
656 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 658 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
657 ngx_rename_file_n " %s back to %s failed after " 659 ngx_rename_file_n " %s back to %s failed after "
658 "an attempt to execute new binary process \"%s\"", 660 "an attempt to execute new binary process \"%s\"",
659 ccf->oldpid.data, ccf->pid.data, argv[0]); 661 ccf->oldpid.data, ccf->pid.data, argv[0]);
660 } 662 }