Browse Source

[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)
Glenn Strauss 1 month ago
parent
commit
89b5448ba0
  1. 9
      tests/fcgi-responder.c

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

Loading…
Cancel
Save