1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-05 19:35:52 +03:00

[BZ #22830] malloc_stats: restore cancellation for stderr correctly.

malloc_stats means to disable cancellation for writes to stderr while
it runs, but it restores stderr->_flags2 with |= instead of =, so what
it actually does is disable cancellation on stderr permanently.

	[BZ #22830]
	* malloc/malloc.c (__malloc_stats): Restore stderr->_flags2
        correctly.
        * malloc/tst-malloc-stats-cancellation.c: New test case.
        * malloc/Makefile: Add new test case.
This commit is contained in:
Zack Weinberg
2018-02-10 16:24:17 -05:00
parent 4f5b921eb9
commit 402ecba487
4 changed files with 227 additions and 1 deletions

View File

@@ -5009,7 +5009,7 @@ __malloc_stats (void)
fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
fprintf (stderr, "max mmap bytes = %10lu\n",
(unsigned long) mp_.max_mmapped_mem);
((_IO_FILE *) stderr)->_flags2 |= old_flags2;
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}