admindebug: Enforce need of TTY to turn on debug mode

Fix #1580
Close #1581
This commit is contained in:
Jos Ahrens
2018-07-21 11:20:57 +00:00
committed by Alexey Sokolov
parent 8f2269083a
commit d7e94d7ac5

View File

@@ -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;