util: backport scope_exit & co. from the Library Fundamentals TS v3
Implementation taken from scope-lite by Martin Moene,
commit 197cd4240069b2b8c393ad0d9eabdee601b606b4
Change-Id: I872b6821504b3270ebdc4c48b7255731fb2efc57
diff --git a/tools/ndnsec/export.cpp b/tools/ndnsec/export.cpp
index 79bea3d..2b6d528 100644
--- a/tools/ndnsec/export.cpp
+++ b/tools/ndnsec/export.cpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/security/impl/openssl.hpp"
#include "ndn-cxx/util/io.hpp"
-
-#include <boost/scope_exit.hpp>
+#include "ndn-cxx/util/scope.hpp"
namespace ndn {
namespace ndnsec {
@@ -42,11 +41,9 @@
std::string output;
std::string password;
- // ASan reports a stack-use-after-scope on armhf when
- // BOOST_SCOPE_EXIT_ALL is used in place of BOOST_SCOPE_EXIT
- BOOST_SCOPE_EXIT(&password) {
+ auto guard = make_scope_exit([&password] {
OPENSSL_cleanse(&password.front(), password.size());
- } BOOST_SCOPE_EXIT_END
+ });
po::options_description visibleOptDesc(
"Usage: ndnsec export [-h] [-o FILE] [-P PASSPHRASE] [-i|-k|-c] NAME\n"