Valgrind reports an invalid close of file descriptor -1. After this
patch haproxy that is started with:

./haproxy -d -Sa /scratch/haproxy/cli.sock -Ws -f ./haproxy.cfg

aborts in the child process to outline the place where the bug needs
to be fixed.

Best regards
---
 src/haproxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/haproxy.c b/src/haproxy.c
index 54ab7c86..e299d7a6 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -26,6 +26,7 @@
  */
 
 #define _GNU_SOURCE
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -3099,6 +3100,7 @@ int main(int argc, char **argv)
                                 * workers, we don't need to close the worker
                                 * side of other workers since it's done with
                                 * the bind_proc */
+                               assert(child->ipc_fd[0] > -1);
                                close(child->ipc_fd[0]);
                                if (child->relative_pid == relative_pid &&
                                    child->reloads == 0) {
-- 
2.19.2


Reply via email to