Created
November 5, 2015 17:51
-
-
Save lloesche/f4f70a9dd585ba3ffa21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/haproxy-systemd-wrapper.c b/src/haproxy-systemd-wrapper.c | |
index e588af9..bfce4e6 100644 | |
--- a/src/haproxy-systemd-wrapper.c | |
+++ b/src/haproxy-systemd-wrapper.c | |
@@ -60,6 +60,8 @@ static void locate_haproxy(char *buffer, size_t buffer_size) | |
return; | |
} | |
+static int read_pids(char ***pid_strv); | |
+ | |
static void spawn_haproxy(char **pid_strv, int nb_pid) | |
{ | |
char haproxy_bin[512]; | |
@@ -95,6 +97,20 @@ static void spawn_haproxy(char **pid_strv, int nb_pid) | |
execv(argv[0], argv); | |
exit(0); | |
+ } else if (nb_pid > 0) { | |
+ while(1) { | |
+ char **rld_pid_strv = NULL; | |
+ int rld_nb_pid = read_pids(&rld_pid_strv); | |
+ int i; | |
+ for (i = 0; i < rld_nb_pid; ++i) { | |
+ if(strcmp(pid_strv[i], rld_pid_strv[i]) != 0) { | |
+ free(rld_pid_strv); | |
+ return; | |
+ } | |
+ } | |
+ free(rld_pid_strv); | |
+ usleep(100); | |
+ } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment