From e3683f204b669405e9e7c98ae08997fcf41add45 Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 28 Jun 2008 10:26:41 +0000 Subject: [PATCH] CUtils::GetInput(): Kill ZNC if reading from stdin fails git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1109 726aef4b-f618-498e-8847-2d620e286838 --- Utils.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Utils.cpp b/Utils.cpp index a0a0e66c..ffbf27c2 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -257,7 +257,11 @@ bool CUtils::GetInput(const CString& sPrompt, CString& sRet, const CString& sDef PrintPrompt(sPrompt + sExtra); char szBuf[1024]; memset(szBuf, 0, 1024); - fgets(szBuf, 1024, stdin); + if (fgets(szBuf, 1024, stdin) == NULL) { + // Reading failed (Error? EOF?) + PrintError("Error while reading from stdin. Exiting..."); + exit(-1); + } sInput = szBuf; if (sInput.Right(1) == "\n") {