From cbb0fcf8817b44649ea563578401706722c00630 Mon Sep 17 00:00:00 2001 From: psychon Date: Sun, 10 Feb 2008 16:46:28 +0000 Subject: [PATCH] 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 --- znc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/znc.cpp b/znc.cpp index 491452f0..3187813a 100644 --- a/znc.cpp +++ b/znc.cpp @@ -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 {