SHA256
1
0
forked from pool/haproxy
haproxy/0008-LOW-systemd-wrapper-Write-debug-information-to-stdou.patch
2014-05-06 15:38:15 +00:00

66 lines
1.8 KiB
Diff

From d581d9a037bfffe7900a1e5a1ec740e67002f974 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
Date: Fri, 22 Nov 2013 11:11:54 +0100
Subject: [PATCH 08/15] LOW: systemd-wrapper: Write debug information to stdout
Write the command line used to call haproxy to stdout, as
well as the return code returned by the haproxy process.
---
src/haproxy-systemd-wrapper.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/haproxy-systemd-wrapper.c b/src/haproxy-systemd-wrapper.c
index d337f4c0d44e..4ca86dd3b8c0 100644
--- a/src/haproxy-systemd-wrapper.c
+++ b/src/haproxy-systemd-wrapper.c
@@ -55,6 +55,12 @@ static void spawn_haproxy(char **pid_strv, int nb_pid)
argv[argno++] = pid_strv[i];
}
argv[argno] = NULL;
+
+ printf("%s", "haproxy-systemd-wrapper: executing ");
+ for (i = 0; argv[i]; ++i)
+ printf("%s ", argv[i]);
+ puts("");
+
execv(argv[0], argv);
exit(0);
}
@@ -104,6 +110,7 @@ static void sigint_handler(int signum __attribute__((unused)))
for (i = 0; i < nb_pid; ++i) {
pid = atoi(pid_strv[i]);
if (pid > 0) {
+ printf("haproxy-systemd-wrapper: SIGINT -> %d\n", pid);
kill(pid, SIGINT);
free(pid_strv[i]);
}
@@ -126,9 +133,11 @@ static void init(int argc, char **argv)
int main(int argc, char **argv)
{
+ int status;
+
--argc; ++argv;
- main_argc = argc;
- main_argv = argv;
+ main_argc = argc;
+ main_argv = argv;
init(argc, argv);
@@ -136,7 +145,10 @@ int main(int argc, char **argv)
signal(SIGUSR2, &sigusr2_handler);
spawn_haproxy(NULL, 0);
- while (-1 != wait(NULL) || errno == EINTR);
+ status = -1;
+ while (-1 != wait(&status) || errno == EINTR)
+ ;
+ printf("haproxy-systemd-wrapper: exit, haproxy RC=%d\n", status);
return EXIT_SUCCESS;
}
--
1.8.4.5