1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Don't assume that madvise() is available even if related macros are defined.

This commit is contained in:
Frank Denis 2014-11-22 13:32:54 -08:00
parent 133118ca4d
commit d0eab9323f
2 changed files with 3 additions and 3 deletions

View File

@ -407,7 +407,7 @@ dnl Checks for functions and headers
AS_IF([test "x$EMSCRIPTEN" = "x"],[
AC_CHECK_FUNCS([arc4random arc4random_buf])
AC_CHECK_FUNCS([mlock mprotect explicit_bzero])
AC_CHECK_FUNCS([mlock madvise mprotect explicit_bzero])
])
AC_CHECK_FUNCS([posix_memalign])

View File

@ -175,7 +175,7 @@ sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
int
sodium_mlock(void * const addr, const size_t len)
{
#ifdef MADV_DONTDUMP
#if defined(MADV_DONTDUMP) && defined(HAVE_MADVISE)
(void) madvise(addr, len, MADV_DONTDUMP);
#endif
#ifdef HAVE_MLOCK
@ -192,7 +192,7 @@ int
sodium_munlock(void * const addr, const size_t len)
{
sodium_memzero(addr, len);
#ifdef MADV_DODUMP
#if defined(MADV_DODUMP) && defined(HAVE_MADVISE)
(void) madvise(addr, len, MADV_DODUMP);
#endif
#ifdef HAVE_MLOCK