Skip to content

Commit 2045810

Browse files
Upgrade nginx to latest stable version 1.28.1 (#14919)
1 parent 153b4cb commit 2045810

11 files changed

+1082
-302
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From d6baea50cd55bc1ae9df1b8d1327b998ac738e0e Mon Sep 17 00:00:00 2001
2+
From: Felix Kaechele <felix@kaechele.ca>
3+
Date: Sun, 7 Jun 2020 12:14:02 -0400
4+
Subject: [PATCH 1/5] remove Werror in upstream build scripts
5+
6+
removes -Werror in upstream build scripts. -Werror conflicts with
7+
-D_FORTIFY_SOURCE=2 causing warnings to turn into errors.
8+
9+
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
10+
---
11+
auto/cc/gcc | 4 +++-
12+
1 file changed, 3 insertions(+), 1 deletion(-)
13+
14+
diff --git a/auto/cc/gcc b/auto/cc/gcc
15+
index a5c5c18fba3f..cdbbadb54023 100644
16+
--- a/auto/cc/gcc
17+
+++ b/auto/cc/gcc
18+
@@ -166,7 +166,9 @@ esac
19+
20+
21+
# stop on warning
22+
-CFLAGS="$CFLAGS -Werror"
23+
+# This combined with Fedora's FORTIFY_SOURCE=2 option causes it nginx
24+
+# to not compile.
25+
+#CFLAGS="$CFLAGS -Werror"
26+
27+
# debug
28+
CFLAGS="$CFLAGS -g"
29+
--
30+
2.52.0
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
From 03b18ac401de8df804b1cc455ded06359dae2374 Mon Sep 17 00:00:00 2001
2+
From: Felix Kaechele <felix@kaechele.ca>
3+
Date: Tue, 20 Apr 2021 21:28:18 -0400
4+
Subject: [PATCH 2/5] fix PIDFile handling
5+
6+
Corresponding RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1869026
7+
8+
Rejected upstream: https://trac.nginx.org/nginx/ticket/1897
9+
10+
Taken from: https://git.launchpad.net/ubuntu/+source/nginx/tree/debian/patches/nginx-fix-pidfile.patch
11+
12+
From original patch:
13+
Author: Tj <ubuntu@iam.tj>
14+
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864
15+
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876365
16+
Last-Update: 2020-06-24
17+
18+
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
19+
---
20+
src/core/nginx.c | 24 +++++++++++++++++++++---
21+
src/os/unix/ngx_daemon.c | 8 ++++++--
22+
2 files changed, 27 insertions(+), 5 deletions(-)
23+
24+
diff --git a/src/core/nginx.c b/src/core/nginx.c
25+
index 0deb27b7f98a..23edb59ff105 100644
26+
--- a/src/core/nginx.c
27+
+++ b/src/core/nginx.c
28+
@@ -340,14 +340,21 @@ main(int argc, char *const *argv)
29+
ngx_process = NGX_PROCESS_MASTER;
30+
}
31+
32+
+ /* tell-tale to detect if this is parent or child process */
33+
+ ngx_int_t child_pid = NGX_BUSY;
34+
+
35+
#if !(NGX_WIN32)
36+
37+
if (ngx_init_signals(cycle->log) != NGX_OK) {
38+
return 1;
39+
}
40+
41+
+ /* tell-tale that this code has been executed */
42+
+ child_pid--;
43+
+
44+
if (!ngx_inherited && ccf->daemon) {
45+
- if (ngx_daemon(cycle->log) != NGX_OK) {
46+
+ child_pid = ngx_daemon(cycle->log);
47+
+ if (child_pid == NGX_ERROR) {
48+
return 1;
49+
}
50+
51+
@@ -360,8 +367,19 @@ main(int argc, char *const *argv)
52+
53+
#endif
54+
55+
- if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
56+
- return 1;
57+
+ /* If ngx_daemon() returned the child's PID in the parent process
58+
+ * after the fork() set ngx_pid to the child_pid, which gets
59+
+ * written to the PID file, then exit.
60+
+ * For NGX_WIN32 always write the PID file
61+
+ * For others, only write it from the parent process */
62+
+ if (child_pid < NGX_OK || child_pid > NGX_OK) {
63+
+ ngx_pid = child_pid > NGX_OK ? child_pid : ngx_pid;
64+
+ if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
65+
+ return 1;
66+
+ }
67+
+ }
68+
+ if (child_pid > NGX_OK) {
69+
+ exit(0);
70+
}
71+
72+
if (ngx_log_redirect_stderr(cycle) != NGX_OK) {
73+
diff --git a/src/os/unix/ngx_daemon.c b/src/os/unix/ngx_daemon.c
74+
index 385c49b6c3d1..3719854c52b0 100644
75+
--- a/src/os/unix/ngx_daemon.c
76+
+++ b/src/os/unix/ngx_daemon.c
77+
@@ -7,14 +7,17 @@
78+
79+
#include <ngx_config.h>
80+
#include <ngx_core.h>
81+
+#include <unistd.h>
82+
83+
84+
ngx_int_t
85+
ngx_daemon(ngx_log_t *log)
86+
{
87+
int fd;
88+
+ /* retain the return value for passing back to caller */
89+
+ pid_t pid_child = fork();
90+
91+
- switch (fork()) {
92+
+ switch (pid_child) {
93+
case -1:
94+
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "fork() failed");
95+
return NGX_ERROR;
96+
@@ -23,7 +26,8 @@ ngx_daemon(ngx_log_t *log)
97+
break;
98+
99+
default:
100+
- exit(0);
101+
+ /* let caller do the exit() */
102+
+ return pid_child;
103+
}
104+
105+
ngx_parent = ngx_pid;
106+
--
107+
2.52.0

0 commit comments

Comments
 (0)