summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2016-01-21 11:51:37 +0100
committerDaniel Mack <github@zonque.org>2016-01-21 11:51:37 +0100
commit127a45c36f3c4ec04b6a7e3067b127ecb5894fdf (patch)
treed1c215da96e4fde3a19aaec4cf2002067f93679d /src/core
parent9ecbcdffdf15bb76f57e8c403070dd43e206858d (diff)
parentdcadc9671c5ff0e4c1e7b6385f63a84387279f93 (diff)
Merge pull request #2371 from evverx/add-valgrind-helper-for-daemon-reexec
core: add valgrind helper for daemon-reexec
Diffstat (limited to 'src/core')
-rw-r--r--src/core/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 2f9094f03a..27ba6af031 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1968,6 +1968,15 @@ finish:
(void) clearenv();
assert(i <= args_size);
+
+ /*
+ * We want valgrind to print its memory usage summary before reexecution.
+ * Valgrind won't do this is on its own on exec(), but it will do it on exit().
+ * Hence, to ensure we get a summary here, fork() off a child, let it exit() cleanly,
+ * so that it prints the summary, and wait() for it in the parent, before proceeding into the exec().
+ */
+ valgrind_summary_hack();
+
(void) execv(args[0], (char* const*) args);
}