summaryrefslogtreecommitdiff
path: root/infrastructure/buildenv-testmain-template.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure/buildenv-testmain-template.cpp')
-rw-r--r--infrastructure/buildenv-testmain-template.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/infrastructure/buildenv-testmain-template.cpp b/infrastructure/buildenv-testmain-template.cpp
index d946c25d..6aba82c5 100644
--- a/infrastructure/buildenv-testmain-template.cpp
+++ b/infrastructure/buildenv-testmain-template.cpp
@@ -44,6 +44,10 @@
#include <list>
#include <string>
+#ifdef HAVE_OPENSSL_CLEANUP
+# include <openssl/crypto.h>
+#endif
+
#include "box_getopt.h"
#include "depot.h"
#include "Logging.h"
@@ -392,6 +396,14 @@ int main(int argc, char * const * argv)
{
Logging::GetSyslog().Shutdown();
+ // On Ubuntu 18.04, initialising OpenSSL 1.1.1 leaves open file handles to
+ // /dev/[u]random which are not easy to close (the docs for OPENSSL_cleanup
+ // recommend not to call it), but we want to avoid detecting those as
+ // leaking file descriptors
+#ifdef HAVE_OPENSSL_CLEANUP
+ OPENSSL_cleanup();
+#endif
+
bool filesleftopen = !checkfilesleftopen();
fflush(stdout);