summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src/core/nginx.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/nginx/src/core/nginx.c')
-rw-r--r--usr.sbin/nginx/src/core/nginx.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/nginx/src/core/nginx.c b/usr.sbin/nginx/src/core/nginx.c
index 2fc6fd53750..875fe07f06e 100644
--- a/usr.sbin/nginx/src/core/nginx.c
+++ b/usr.sbin/nginx/src/core/nginx.c
@@ -596,6 +596,10 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
var = ngx_alloc(sizeof(NGINX_VAR)
+ cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
cycle->log);
+ if (var == NULL) {
+ ngx_free(env);
+ return NGX_INVALID_PID;
+ }
p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
@@ -635,7 +639,7 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
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\"",
@@ -650,7 +654,9 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
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\"",