]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: rename master process name in -Ds (systemd mode)
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 14 Jan 2016 17:10:30 +0000 (18:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 14 Jan 2016 17:29:15 +0000 (18:29 +0100)
To avoid confusion between the master process and child processes,
the master process is renamed after the forks.

src/haproxy.c

index 21a5e1286de8c4b1ebbca71c7f9f5c814c85f054..f7b4cedf6967a025d2033d6b34227e0819bcd1be 100644 (file)
@@ -1870,7 +1870,14 @@ int main(int argc, char **argv)
 
                if (proc == global.nbproc) {
                        if (global.mode & MODE_SYSTEMD) {
+                               int i;
+
                                protocol_unbind_all();
+                               for (i = 1; i < argc; i++) {
+                                       memset(argv[i], '\0', strlen(argv[i]));
+                               }
+                               /* it's OK because "-Ds -f x" is the shortest form going here */
+                               memcpy(argv[0] + strlen(argv[0]), "-master", 8);
                                for (proc = 0; proc < global.nbproc; proc++)
                                        while (waitpid(children[proc], NULL, 0) == -1 && errno == EINTR);
                        }