From ab307dc645502d025c2760160062d5032da56bf7 Mon Sep 17 00:00:00 2001 From: David von Oheimb Date: Mon, 8 Jan 2018 14:13:51 +0100 Subject: Various small build improvements on mkdef.pl, progs.pl, crypto/init.c, crypto/mem.c Reviewed-by: Andy Polyakov Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/4994) --- crypto/mem.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crypto/mem.c') diff --git a/crypto/mem.c b/crypto/mem.c index c77584cd5f..920f7999fc 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -136,9 +136,9 @@ static void parseit(void) * Some rand() implementations aren't good, but we're not * dealing with secure randomness here. */ -#ifdef _WIN32 -# define random() rand() -#endif +# ifdef _WIN32 +# define random() rand() +# endif /* * See if the current malloc should fail. */ @@ -146,6 +146,8 @@ static int shouldfail(void) { int roll = (int)(random() % 100); int shoulditfail = roll < md_fail_percent; +# ifndef _WIN32 +/* suppressed on Windows as POSIX-like file descriptors are non-inheritable */ int len; char buff[80]; @@ -156,15 +158,16 @@ static int shouldfail(void) len = strlen(buff); if (write(md_tracefd, buff, len) != len) perror("shouldfail write failed"); -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE if (shoulditfail) { void *addrs[30]; int num = backtrace(addrs, OSSL_NELEM(addrs)); backtrace_symbols_fd(addrs, num, md_tracefd); } -#endif +# endif } +# endif if (md_count) { /* If we used up this one, go to the next. */ -- cgit v1.2.3