post() contains code to be run after all necessary processes have
been forked. It includes code that will be run even if no processes
are forked.

It will be expanded by changes to facilitate the master
process running outside the chroot.

Signed-off-by: Simon Horman <[email protected]>
---
 src/haproxy.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/haproxy.c b/src/haproxy.c
index 26a3dc5..13bb398 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1474,6 +1474,14 @@ static void create_processes(int argc, char **argv, FILE 
*pidfile)
        replacing_workers = 0;
 }
 
+static void post(const char *name)
+{
+       if (!is_master)
+               setid(name);
+
+       protocol_enable_all();
+}
+
 int main(int argc, char **argv)
 {
        FILE *pidfile = NULL;
@@ -1491,11 +1499,7 @@ int main(int argc, char **argv)
                        global.mode = (global.mode &
                                       ~(MODE_QUIET|MODE_VERBOSE)) | mode;
                create_processes(argc, argv, pidfile);
-
-               if (!is_master)
-                       setid(argv[0]);
-
-               protocol_enable_all();
+               post(argv[0]);
 
                /*
                 * That's it : the central polling loop. Run until we stop.
-- 
1.7.2.3


Reply via email to