diff src/os/unix/ngx_process_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 791ead216b03
children
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -619,9 +619,10 @@ ngx_reap_children(ngx_cycle_t *cycle)
                 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx,
                                                        ngx_core_module);
 
-                if (ngx_rename_file((char *) ccf->oldpid.data,
-                                    (char *) ccf->pid.data)
-                    == NGX_FILE_ERROR)
+                if (ccf->pid.len
+                    && ngx_rename_file((char *) ccf->oldpid.data,
+                                       (char *) 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 "