[nginx] Fixed ngx_pid_t formatting in ngx_sprintf() and logging.

Sergey Kandaurov pluknet at nginx.com
Wed Mar 30 23:35:16 UTC 2016


details:   http://hg.nginx.org/nginx/rev/2b7dacb381ed
branches:  
changeset: 6482:2b7dacb381ed
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Thu Mar 31 02:34:04 2016 +0300
description:
Fixed ngx_pid_t formatting in ngx_sprintf() and logging.

diffstat:

 src/os/unix/ngx_process.c        |  2 +-
 src/os/win32/ngx_process.c       |  6 +++---
 src/os/win32/ngx_process_cycle.c |  8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r 40bea39731d7 -r 2b7dacb381ed src/os/unix/ngx_process.c
--- a/src/os/unix/ngx_process.c	Thu Mar 31 02:34:00 2016 +0300
+++ b/src/os/unix/ngx_process.c	Thu Mar 31 02:34:04 2016 +0300
@@ -622,7 +622,7 @@ ngx_os_signal_process(ngx_cycle_t *cycle
             }
 
             ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
-                          "kill(%P, %d) failed", pid, sig->signo);
+                          "kill(%P, %d) failed", (ngx_pid_t) pid, sig->signo);
         }
     }
 
diff -r 40bea39731d7 -r 2b7dacb381ed src/os/win32/ngx_process.c
--- a/src/os/win32/ngx_process.c	Thu Mar 31 02:34:00 2016 +0300
+++ b/src/os/win32/ngx_process.c	Thu Mar 31 02:34:04 2016 +0300
@@ -76,9 +76,9 @@ ngx_spawn_process(ngx_cycle_t *cycle, ch
     ngx_processes[s].pid = pid;
     ngx_processes[s].name = name;
 
-    ngx_sprintf(ngx_processes[s].term_event, "ngx_%s_term_%ul%Z", name, pid);
-    ngx_sprintf(ngx_processes[s].quit_event, "ngx_%s_quit_%ul%Z", name, pid);
-    ngx_sprintf(ngx_processes[s].reopen_event, "ngx_%s_reopen_%ul%Z",
+    ngx_sprintf(ngx_processes[s].term_event, "ngx_%s_term_%P%Z", name, pid);
+    ngx_sprintf(ngx_processes[s].quit_event, "ngx_%s_quit_%P%Z", name, pid);
+    ngx_sprintf(ngx_processes[s].reopen_event, "ngx_%s_reopen_%P%Z",
                 name, pid);
 
     events[0] = ngx_master_process_event;
diff -r 40bea39731d7 -r 2b7dacb381ed src/os/win32/ngx_process_cycle.c
--- a/src/os/win32/ngx_process_cycle.c	Thu Mar 31 02:34:00 2016 +0300
+++ b/src/os/win32/ngx_process_cycle.c	Thu Mar 31 02:34:04 2016 +0300
@@ -581,7 +581,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cy
 
     ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0, "worker started");
 
-    ngx_sprintf((u_char *) wtevn, "ngx_worker_term_%ul%Z", ngx_pid);
+    ngx_sprintf((u_char *) wtevn, "ngx_worker_term_%P%Z", ngx_pid);
     events[0] = CreateEvent(NULL, 1, 0, wtevn);
     if (events[0] == NULL) {
         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
@@ -589,7 +589,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cy
         goto failed;
     }
 
-    ngx_sprintf((u_char *) wqevn, "ngx_worker_quit_%ul%Z", ngx_pid);
+    ngx_sprintf((u_char *) wqevn, "ngx_worker_quit_%P%Z", ngx_pid);
     events[1] = CreateEvent(NULL, 1, 0, wqevn);
     if (events[1] == NULL) {
         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
@@ -597,7 +597,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cy
         goto failed;
     }
 
-    ngx_sprintf((u_char *) wroevn, "ngx_worker_reopen_%ul%Z", ngx_pid);
+    ngx_sprintf((u_char *) wroevn, "ngx_worker_reopen_%P%Z", ngx_pid);
     events[2] = CreateEvent(NULL, 1, 0, wroevn);
     if (events[2] == NULL) {
         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
@@ -1007,7 +1007,7 @@ ngx_os_signal_process(ngx_cycle_t *cycle
     ngx_int_t  rc;
     char       evn[NGX_PROCESS_SYNC_NAME];
 
-    ngx_sprintf((u_char *) evn, "Global\\ngx_%s_%ul%Z", sig, pid);
+    ngx_sprintf((u_char *) evn, "Global\\ngx_%s_%P%Z", sig, (ngx_pid_t) pid);
 
     ev = OpenEvent(EVENT_MODIFY_STATE, 0, evn);
     if (ev == NULL) {



More information about the nginx-devel mailing list