diff options
author | David von Oheimb <David.von.Oheimb@siemens.com> | 2018-01-08 14:13:51 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2018-01-09 04:02:34 +0100 |
commit | ab307dc645502d025c2760160062d5032da56bf7 (patch) | |
tree | 6bfe9f084ed755c5d5949dfc873e2c5748a72f4b /crypto | |
parent | c3f7971d89c51def9bfac67797ea24c058f64091 (diff) |
Various small build improvements on mkdef.pl, progs.pl, crypto/init.c, crypto/mem.c
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4994)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/init.c | 2 | ||||
-rw-r--r-- | crypto/mem.c | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/crypto/init.c b/crypto/init.c index 143e01a44a..a10b48d435 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -73,7 +73,6 @@ struct ossl_init_stop_st { }; static CRYPTO_RWLOCK *glock_lock = NULL; -static CRYPTO_ONCE glock_once = CRYPTO_ONCE_STATIC_INIT; static OPENSSL_INIT_STOP *stop_handlers = NULL; static CRYPTO_RWLOCK *init_lock = NULL; @@ -726,6 +725,7 @@ DEFINE_RUN_ONCE_STATIC(glock_init) */ CRYPTO_RWLOCK *CRYPTO_THREAD_glock_new(const char *name) { + static CRYPTO_ONCE glock_once = CRYPTO_ONCE_STATIC_INIT; GLOBAL_LOCK *newlock; if (glock_lock == NULL && !RUN_ONCE(&glock_once, glock_init)) 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. */ |