forked from pool/haproxy
0b429848d7
Update to 1.4.25. Amended SR with missing patch information in .changes OBS-URL: https://build.opensuse.org/request/show/232846 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/haproxy?expand=0&rev=4
55 lines
1.5 KiB
Diff
55 lines
1.5 KiB
Diff
From 1c9ed41d4cdfdb31381e89f1a8b93df01220fe07 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
|
|
Date: Fri, 22 Nov 2013 11:06:34 +0100
|
|
Subject: [PATCH 06/15] MEDIUM: haproxy-systemd-wrapper: Use haproxy in same
|
|
directory
|
|
|
|
Locate the wrapper and use a haproxy executable found in the
|
|
same directory.
|
|
|
|
This patch lets the wrapper work in openSUSE.
|
|
---
|
|
src/haproxy-systemd-wrapper.c | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/haproxy-systemd-wrapper.c b/src/haproxy-systemd-wrapper.c
|
|
index fb1a7fd92724..6546616b79ee 100644
|
|
--- a/src/haproxy-systemd-wrapper.c
|
|
+++ b/src/haproxy-systemd-wrapper.c
|
|
@@ -22,15 +22,30 @@ static char *pid_file = "/run/haproxy.pid";
|
|
static int main_argc;
|
|
static char **main_argv;
|
|
|
|
+static void locate_haproxy(char *buffer, size_t buffer_size)
|
|
+{
|
|
+ char* end;
|
|
+ readlink("/proc/self/exe", buffer, buffer_size);
|
|
+ end = strrchr(buffer, '/');
|
|
+ if (end == NULL)
|
|
+ strncpy(buffer, "/usr/sbin/haproxy", buffer_size);
|
|
+ end[1] = '\0';
|
|
+ strncat(buffer, "haproxy", buffer_size);
|
|
+}
|
|
+
|
|
static void spawn_haproxy(char **pid_strv, int nb_pid)
|
|
{
|
|
- pid_t pid = fork();
|
|
+ char haproxy_bin[512];
|
|
+ pid_t pid;
|
|
+
|
|
+ pid = fork();
|
|
if (!pid) {
|
|
/* 3 for "haproxy -Ds -sf" */
|
|
char **argv = calloc(4 + main_argc + nb_pid + 1, sizeof(char *));
|
|
int i;
|
|
int argno = 0;
|
|
- argv[argno++] = SBINDIR"/haproxy";
|
|
+ locate_haproxy(haproxy_bin, 512);
|
|
+ argv[argno++] = haproxy_bin;
|
|
for (i = 0; i < main_argc; ++i)
|
|
argv[argno++] = main_argv[i];
|
|
argv[argno++] = "-Ds";
|
|
--
|
|
1.8.4.5
|
|
|