summaryrefslogtreecommitdiffstats
path: root/include/closestream.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/closestream.h')
-rw-r--r--include/closestream.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/closestream.h b/include/closestream.h
index b3b257c94..0ce34fe52 100644
--- a/include/closestream.h
+++ b/include/closestream.h
@@ -51,6 +51,17 @@ close_stdout(void)
_exit(CLOSE_EXIT_CODE);
}
+static inline void
+close_stdout_atexit(void)
+{
+ /*
+ * Note that close stdout at exit disables ASAN to report memory leaks
+ */
+#ifdef USE_CLOSE_ATEXIT
+ atexit(close_stdout);
+#endif
+}
+
#ifndef HAVE_FSYNC
static inline int
fsync(int fd __attribute__((__unused__)))