From d7e94d7ac5fa19090f929df24cd358c2bd262552 Mon Sep 17 00:00:00 2001 From: Jos Ahrens Date: Sat, 21 Jul 2018 11:20:57 +0000 Subject: [PATCH] admindebug: Enforce need of TTY to turn on debug mode Fix #1580 Close #1581 --- modules/admindebug.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/admindebug.cpp b/modules/admindebug.cpp index 9cf32f16..2f68f5e2 100644 --- a/modules/admindebug.cpp +++ b/modules/admindebug.cpp @@ -54,6 +54,11 @@ class CAdminDebugMod : public CModule { } bool ToggleDebug(bool bEnable, CString sEnabledBy) { + if (!CDebug::StdoutIsTTY()) { + PutModule(t_s("Failure. We need to be running with a TTY. (is ZNC running with --foreground?)")); + return false; + } + bool bValue = CDebug::Debug(); if (bEnable == bValue) { @@ -77,7 +82,7 @@ class CAdminDebugMod : public CModule { ); m_sEnabledBy = sEnabledBy; } else { - m_sEnabledBy = nullptr; + m_sEnabledBy = ""; } return true;