free: preserve errno [BZ#17924]
commit69fda43b8dd795c3658869633ca0708ed3134006
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Dec 2020 08:45:49 +0000 (29 00:45 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Dec 2020 08:46:46 +0000 (29 00:46 -0800)
treee86b216293d450bfbecaaf8230c3247444b668c4
parent016c64236dee6e28f09c10ba38f274aad7205f95
free: preserve errno [BZ#17924]

In the next release of POSIX, free must preserve errno
<https://www.austingroupbugs.net/view.php?id=385>.
Modify __libc_free to save and restore errno, so that
any internal munmap etc. syscalls do not disturb the caller's errno.
Add a test malloc/tst-free-errno.c (almost all by Bruno Haible),
and document that free preserves errno.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
malloc/Makefile
malloc/malloc.c
malloc/tst-free-errno.c [new file with mode: 0644]
manual/memory.texi