Only read from stdin if stdin is a TTY

This fixes an endless loop on rehash.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@952 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-02-10 16:46:28 +00:00
parent e326f6eb35
commit cbb0fcf881
+3 -2
View File
@@ -1275,8 +1275,9 @@ bool CZNC::DoRehash(CString& sError)
sError = "Unable to locate pem file: [" + sPemFile + "]";
CUtils::PrintStatus(false, sError);
#warning what if we closed stdin already?
if (CUtils::GetBoolInput("Would you like to create a new pem file?", true)) {
// If stdin is e.g. /dev/null and we call GetBoolInput(),
// we are stuck in an endless loop!
if (isatty(0) && CUtils::GetBoolInput("Would you like to create a new pem file?", true)) {
sError.clear();
WritePemFile();
} else {