build: Fix conditional compilation on availability of getpass()
Change-Id: I3aa95c1b6afe2239f24642507da8090f7f58abac
Refs: #2419
diff --git a/src/security/sec-tpm-osx.cpp b/src/security/sec-tpm-osx.cpp
index 1abfcec..4400343 100644
--- a/src/security/sec-tpm-osx.cpp
+++ b/src/security/sec-tpm-osx.cpp
@@ -328,6 +328,7 @@
m_impl->m_password.c_str(),
true);
}
+#ifdef NDN_CXX_HAVE_GETPASS
else if (m_impl->m_inTerminal)
{
// If no configured password, get password from terminal if inTerminal set.
@@ -358,6 +359,7 @@
break;
}
}
+#endif // NDN_CXX_HAVE_GETPASS
else
{
// If inTerminal is not set, get the password from GUI.
diff --git a/src/security/sec-tpm.cpp b/src/security/sec-tpm.cpp
index eb107b1..5c12049 100644
--- a/src/security/sec-tpm.cpp
+++ b/src/security/sec-tpm.cpp
@@ -363,7 +363,7 @@
{
bool isInitialized = false;
-#ifndef NDN_CXX_HAVE_GETPASS
+#ifdef NDN_CXX_HAVE_GETPASS
char* pw0 = 0;
pw0 = getpass(prompt.c_str());
diff --git a/tools/ndnsec/unlock-tpm.hpp b/tools/ndnsec/unlock-tpm.hpp
index 607efb1..2127848 100644
--- a/tools/ndnsec/unlock-tpm.hpp
+++ b/tools/ndnsec/unlock-tpm.hpp
@@ -29,7 +29,7 @@
int
ndnsec_unlock_tpm(int argc, char** argv)
{
-#ifndef NDN_CXX_HAVE_GETPASS
+#ifdef NDN_CXX_HAVE_GETPASS
using namespace ndn;
namespace po = boost::program_options;
diff --git a/tools/ndnsec/util.hpp b/tools/ndnsec/util.hpp
index 2de9ff1..eaf2825 100644
--- a/tools/ndnsec/util.hpp
+++ b/tools/ndnsec/util.hpp
@@ -46,7 +46,7 @@
bool
getPassword(std::string& password, const std::string& prompt)
{
-#ifndef NDN_CXX_HAVE_GETPASS
+#ifdef NDN_CXX_HAVE_GETPASS
bool isReady = false;
char* pw0 = 0;