* NEWS: Document this.
* lib/closeout.c (__has_feature): New macro, if not already defined.
(SANITIZE_ADDRESS): New constant.
(close_stdout): Don’t close stderr if sanitizing addresses.
+2017-05-19 Paul Eggert <eggert@cs.ucla.edu>
+
+ closeout: don’t close stderr when sanitizing
+ * NEWS: Document this.
+ * lib/closeout.c (__has_feature): New macro, if not already defined.
+ (SANITIZE_ADDRESS): New constant.
+ (close_stdout): Don’t close stderr if sanitizing addresses.
+
2017-05-19 Bruno Haible <bruno@clisp.org>
get-rusage-data tests: Avoid failure on Linux/glibc.
Date Modules Changes
+2017-05-19 closeout close_stdout longer closes stderr when addresses
+ are being sanitized, as the sanitizer outputs to
+ stderr afterwards.
+
2017-02-16 binary-io On MS-DOS and OS/2, set_binary_mode now fails
on ttys, and sets errno == EINVAL.
#include "exitfail.h"
#include "quotearg.h"
+#ifndef __has_feature
+# define __has_feature(a) false
+#endif
+
+#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
+enum { SANITIZE_ADDRESS = true };
+#else
+enum { SANITIZE_ADDRESS = false };
+#endif
+
static const char *file_name;
/* Set the file name to be reported in the event an error is detected
_exit (exit_failure);
}
- if (close_stream (stderr) != 0)
- _exit (exit_failure);
+ /* Close stderr only if not sanitizing, as sanitizers may report to
+ stderr after this function returns. */
+ if (!SANITIZE_ADDRESS && close_stream (stderr) != 0)
+ _exit (exit_failure);
}