From 46f71fba9e571eabe286b779bdb9250396aa396b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 13 Sep 2015 15:04:14 +0200 Subject: [PATCH] Check for getpid(2) presence instead of checking for Visual Studio --- configure.ac | 2 +- .../randombytes/salsa20/randombytes_salsa20_random.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index f4bd1b0e..4d85a4e2 100644 --- a/configure.ac +++ b/configure.ac @@ -429,7 +429,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[ AC_CHECK_FUNCS([arc4random arc4random_buf]) AC_CHECK_FUNCS([mmap mlock madvise mprotect explicit_bzero]) ]) -AC_CHECK_FUNCS([posix_memalign]) +AC_CHECK_FUNCS([posix_memalign getpid]) AC_SUBST([LIBTOOL_EXTRA_FLAGS]) diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index 727261f3..595d11d9 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -47,7 +47,7 @@ typedef struct Salsa20Random_ { unsigned char rnd32[16U * SALSA20_RANDOM_BLOCK_SIZE]; uint64_t nonce; size_t rnd32_outleft; -#ifndef _MSC_VER +#ifdef HAVE_GETPID pid_t pid; #endif int random_data_source_fd; @@ -279,7 +279,7 @@ randombytes_salsa20_random_stir(void) COMPILER_ASSERT(sizeof stream.key <= sizeof m0); randombytes_salsa20_random_rekey(m0); sodium_memzero(m0, sizeof m0); -#ifndef _MSC_VER +#ifdef HAVE_GETPID stream.pid = getpid(); #endif } @@ -287,7 +287,7 @@ randombytes_salsa20_random_stir(void) static void randombytes_salsa20_random_stir_if_needed(void) { -#ifdef _MSC_VER +#ifdef HAVE_GETPID if (stream.initialized == 0) { randombytes_salsa20_random_stir(); }