From 61a33b34fca3d1c8ba8974d960bfd2143cf61b64 Mon Sep 17 00:00:00 2001 From: cflakes Date: Sat, 15 May 2010 18:00:34 +0000 Subject: [PATCH] Moved isRoot check to a place before the code for --makeconf. Keeps users from doing --makeconf as root and then wondering why ZNC complains when they try to start it up. --makepass and --makepem still work as root. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1988 726aef4b-f618-498e-8847-2d620e286838 --- main.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main.cpp b/main.cpp index ac34bc9b..2a88fffa 100644 --- a/main.cpp +++ b/main.cpp @@ -185,6 +185,19 @@ int main(int argc, char** argv) { return 0; } + if (isRoot()) { + CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid"); + CUtils::PrintError("reasons for this and it can, in theory, cause great damage!"); + if (!bAllowRoot) { + delete pZNC; + return 1; + } + CUtils::PrintError("You have been warned."); + CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root."); + CUtils::PrintError("ZNC will start in 30 seconds."); + sleep(30); + } + if (bMakeConf) { if (!pZNC->WriteNewConfig(sConfig)) { delete pZNC; @@ -205,19 +218,6 @@ int main(int argc, char** argv) { return 1; } - if (isRoot()) { - CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid"); - CUtils::PrintError("reasons for this and it can, in theory, cause great damage!"); - if (!bAllowRoot) { - delete pZNC; - return 1; - } - CUtils::PrintError("You have been warned."); - CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root."); - CUtils::PrintError("ZNC will start in 30 seconds."); - sleep(30); - } - if (bForeground) { int iPid = getpid(); CUtils::PrintMessage("Staying open for debugging [pid: " + CString(iPid) + "]");