Allow the use of readlinkat over readlink.

This can be useful in situations where readlink is disallowed.
This commit is contained in:
David Goldblatt
2018-08-03 12:47:40 -07:00
committed by David Goldblatt
parent 126252a7e6
commit e8ec9528ab
3 changed files with 27 additions and 0 deletions

View File

@@ -961,7 +961,12 @@ malloc_conf_init(sc_data_t *sc_data) {
* Try to use the contents of the "/etc/malloc.conf"
* symbolic link's name.
*/
#ifndef JEMALLOC_READLINKAT
linklen = readlink(linkname, buf, sizeof(buf) - 1);
#else
linklen = readlinkat(AT_FDCWD, linkname, buf,
sizeof(buf) - 1);
#endif
if (linklen == -1) {
/* No configuration specified. */
linklen = 0;