Mercurial > hg > nginx
diff src/core/ngx_cycle.c @ 9268:6a3ee145d0b5
Core: made it possible to disable PID files with "pid off".
While it is not generally recommended, this might be beneficial in some
configurations, such as with immutable images and direct control by
a service manager.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 13 May 2024 06:13:03 +0300 |
parents | f18db38a9826 |
children | 4eb02e5ddb48 |
line wrap: on
line diff
--- a/src/core/ngx_cycle.c Wed May 08 23:00:07 2024 +0300 +++ b/src/core/ngx_cycle.c Mon May 13 06:13:03 2024 +0300 @@ -1027,6 +1027,10 @@ return NGX_OK; } + if (name->len == 0) { + return NGX_OK; + } + ngx_memzero(&file, sizeof(ngx_file_t)); file.name = *name; @@ -1070,6 +1074,10 @@ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + if (ccf->pid.len == 0) { + return; + } + name = ngx_new_binary ? ccf->oldpid.data : ccf->pid.data; if (ngx_delete_file(name) == NGX_FILE_ERROR) { @@ -1092,6 +1100,12 @@ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + if (ccf->pid.len == 0) { + ngx_log_error(NGX_LOG_ERR, cycle->log, 0, + "no PID file configured"); + return 1; + } + ngx_memzero(&file, sizeof(ngx_file_t)); file.name = ccf->pid;