summaryrefslogtreecommitdiff
path: root/tests/fcgi-responder.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-09-26 11:13:00 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-10-01 06:39:47 -0400
commited2c6983007c52cab1d903d29222f27f53eb5d86 (patch)
treefe72b69aa7b65d10a97efe82e6491775ff1e98ac /tests/fcgi-responder.c
parent41c3cc0965ceeb9a79ef800b8c0578afdc4e452a (diff)
downloadlighttpd-git-ed2c6983007c52cab1d903d29222f27f53eb5d86.tar.gz
[tests] ignore SIGINT, SIGUSR1 in fcgi-responder
ignore SIGINT, SIGUSR1 in fcgi-responder if HAVE_SIGNAL is defined (must be defined separately since config.h is not included) Not required for test framework. Added as an example in the code, e.g. if code is reused with lighttpd and graceful shutdown or restart. (backend will be sent SIGTERM when server is ready to restart)
Diffstat (limited to 'tests/fcgi-responder.c')
-rw-r--r--tests/fcgi-responder.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/fcgi-responder.c b/tests/fcgi-responder.c
index 31ec884b..1b869b8e 100644
--- a/tests/fcgi-responder.c
+++ b/tests/fcgi-responder.c
@@ -25,6 +25,10 @@
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_SIGNAL /* XXX: must be defined; config.h not included here */
+#include <signal.h>
+#endif
+
#ifndef MSG_DONTWAIT
#define MSG_DONTWAIT 0
#endif
@@ -352,6 +356,11 @@ main (void)
fcntl(FCGI_LISTENSOCK_FILENO, F_SETFL,
fcntl(FCGI_LISTENSOCK_FILENO, F_GETFL) & ~O_NONBLOCK);
+ #ifdef HAVE_SIGNAL
+ signal(SIGINT, SIG_IGN);
+ signal(SIGUSR1, SIG_IGN);
+ #endif
+
do {
fd = accept(FCGI_LISTENSOCK_FILENO, NULL, NULL);
if (fd < 0)