comparison src/os/unix/ngx_process_cycle.c @ 5137:f941cf265cc5

Use NGX_FILE_ERROR for handling file operations errors. On Win32 platforms 0 is used to indicate errors in file operations, so comparing against -1 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 Valentin Bartenev <vbart@nginx.com>
date Mon, 25 Mar 2013 15:49:11 +0000
parents 484aec758d2c
children 711fa02afae8
comparison
equal deleted inserted replaced
5136:88a302caca75 5137:f941cf265cc5
645 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, 645 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx,
646 ngx_core_module); 646 ngx_core_module);
647 647
648 if (ngx_rename_file((char *) ccf->oldpid.data, 648 if (ngx_rename_file((char *) ccf->oldpid.data,
649 (char *) ccf->pid.data) 649 (char *) ccf->pid.data)
650 != NGX_OK) 650 == NGX_FILE_ERROR)
651 { 651 {
652 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 652 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
653 ngx_rename_file_n " %s back to %s failed " 653 ngx_rename_file_n " %s back to %s failed "
654 "after the new binary process \"%s\" exited", 654 "after the new binary process \"%s\" exited",
655 ccf->oldpid.data, ccf->pid.data, ngx_argv[0]); 655 ccf->oldpid.data, ccf->pid.data, ngx_argv[0]);