diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-07-16 11:44:02 +0200 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-07-16 11:44:09 +0200 |
commit | c8db8e1724cd189d3865823dc3f0f1154e3a8868 (patch) | |
tree | 30dab8ece42f053f463aff7efaeca0bec4ccbba5 /tests/keylog-env.c | |
parent | 9ba468c457478c1c1fbdd772b45c1564584a160e (diff) | |
download | gnutls-tmp-keylog-threadsafe.tar.gz |
Fix race condition when logging keystmp-keylog-threadsafe
Moves keylog initialization to _gnutls_global_init().
That means SSLKEYLOGFILE has to be set before starting the
application - or more exactly - before library initialization.
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'tests/keylog-env.c')
-rw-r--r-- | tests/keylog-env.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/tests/keylog-env.c b/tests/keylog-env.c index 5f5f74e176..bdc079f868 100644 --- a/tests/keylog-env.c +++ b/tests/keylog-env.c @@ -98,16 +98,6 @@ static void run(const char *filename, const char *prio, const char **p; int ret; -#ifdef _WIN32 - { - char buf[512]; - snprintf(buf, sizeof(buf), "SSLKEYLOGFILE=%s", filename); - _putenv(buf); - } -#else - setenv("SSLKEYLOGFILE", filename, 1); -#endif - if (debug) { gnutls_global_set_log_level(6); gnutls_global_set_log_function(tls_log_func); @@ -151,11 +141,10 @@ static void run(const char *filename, const char *prio, void doit(void) { - char filename[TMPNAME_SIZE]; + const char *filename = getenv("SSLKEYLOGFILE"); - assert(get_tmpname(filename)!=NULL); + assert(filename != NULL); - remove(filename); global_init(); run(filename, |