summaryrefslogtreecommitdiff
path: root/infrastructure/buildenv-testmain-template.cpp
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2020-05-10 19:17:17 -0400
committerReinhard Tartler <siretart@tauware.de>2020-05-10 19:17:17 -0400
commit228bc06db9e262b24a6c235b1e036cc8ef78565f (patch)
tree3703ceb787cf9345600fae3939afeccca7c47719 /infrastructure/buildenv-testmain-template.cpp
parentffb043c482053896b0190ea5ddc1cf2ba70cb4f0 (diff)
parentc5c04da3823c36f03408821cbc5019ec18613922 (diff)
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);