Allow the use of readlinkat over readlink.
This can be useful in situations where readlink is disallowed.
This commit is contained in:
parent
126252a7e6
commit
e8ec9528ab
16
configure.ac
16
configure.ac
@ -1277,6 +1277,22 @@ if test "x$enable_log" = "x1" ; then
|
||||
fi
|
||||
AC_SUBST([enable_log])
|
||||
|
||||
dnl Do not use readlinkat by default
|
||||
AC_ARG_ENABLE([readlinkat],
|
||||
[AS_HELP_STRING([--enable-readlinkat], [Use readlinkat over readlink])],
|
||||
[if test "x$enable_readlinkat" = "xno" ; then
|
||||
enable_readlinkat="0"
|
||||
else
|
||||
enable_readlinkat="1"
|
||||
fi
|
||||
],
|
||||
[enable_readlinkat="0"]
|
||||
)
|
||||
if test "x$enable_readlinkat" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_READLINKAT], [ ])
|
||||
fi
|
||||
AC_SUBST([enable_readlinkat])
|
||||
|
||||
|
||||
JE_COMPILABLE([a program using __builtin_unreachable], [
|
||||
void foo (void) {
|
||||
|
@ -245,6 +245,12 @@
|
||||
*/
|
||||
#undef JEMALLOC_LOG
|
||||
|
||||
/*
|
||||
* If defined, use readlinkat() (instead of readlink()) to follow
|
||||
* /etc/malloc_conf.
|
||||
*/
|
||||
#undef JEMALLOC_READLINKAT
|
||||
|
||||
/*
|
||||
* Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user