[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)
This commit is contained in:
Glenn Strauss 2021-09-26 11:13:00 -04:00
parent 41c3cc0965
commit ed2c698300
1 changed files with 9 additions and 0 deletions

View File

@ -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)