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/import.cpp b/tools/ndnsec/import.cpp
index fa67a44..9dab73f 100644
--- a/tools/ndnsec/import.cpp
+++ b/tools/ndnsec/import.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 {
@@ -38,11 +37,9 @@
std::string input;
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 description(
"Usage: ndnsec import [-h] [-P PASSPHRASE] [-i] FILE\n"