---
server/internal.h | 1 +
server/main.c | 7 ++++---
server/quit.c | 7 +++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/server/internal.h b/server/internal.h
index 4638727..7069df0 100644
--- a/server/internal.h
+++ b/server/internal.h
@@ -127,6 +127,7 @@ extern struct backend *backend;
extern volatile int quit;
extern int quit_fd;
extern void set_up_quit_pipe (void);
+extern void close_quit_pipe (void);
extern void handle_quit (int sig);
extern void set_quit (void);
diff --git a/server/main.c b/server/main.c
index 8ff8e79..9ccba4a 100644
--- a/server/main.c
+++ b/server/main.c
@@ -682,6 +682,9 @@ main (int argc, char *argv[])
/* Select the correct thread model based on config. */
lock_init_thread_model ();
+ set_up_quit_pipe ();
+ set_up_signals ();
+
start_serving ();
backend->free (backend);
@@ -701,6 +704,7 @@ main (int argc, char *argv[])
}
crypto_free ();
+ close_quit_pipe ();
exit (EXIT_SUCCESS);
}
@@ -865,9 +869,6 @@ start_serving (void)
exit (EXIT_FAILURE);
}
- set_up_quit_pipe ();
- set_up_signals ();
-
/* Socket activation -- we are handling connections on pre-opened
* file descriptors [FIRST_SOCKET_ACTIVATION_FD ..
* FIRST_SOCKET_ACTIVATION_FD+nr_socks-1].
diff --git a/server/quit.c b/server/quit.c
index ffd3fec..5a916b2 100644
--- a/server/quit.c
+++ b/server/quit.c
@@ -80,6 +80,13 @@ set_up_quit_pipe (void)
write_quit_fd = fds[1];
}
+void
+close_quit_pipe (void)
+{
+ close (quit_fd);
+ close (write_quit_fd);
+}
+
void
handle_quit (int sig)
{
--
2.23.0