You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.7 KiB

  1. From adf42357c9043c38d9a9b47544a1b46445bdae19 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
  3. Date: Wed, 6 Apr 2011 04:10:23 +0200
  4. Subject: [PATCH] Move the root check to after config parsing
  5. ---
  6. src/main.cpp | 27 ++++++++++++++-------------
  7. 1 file changed, 14 insertions(+), 13 deletions(-)
  8. --- a/src/main.cpp
  9. +++ b/src/main.cpp
  10. @@ -303,19 +303,6 @@ int main(int argc, char** argv) {
  11. CUtils::PrintStatus(true, "");
  12. }
  13. - if (isRoot()) {
  14. - CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
  15. - CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
  16. - if (!bAllowRoot) {
  17. - CZNC::DestroyInstance();
  18. - return 1;
  19. - }
  20. - CUtils::PrintError("You have been warned.");
  21. - CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root.");
  22. - CUtils::PrintError("ZNC will start in 30 seconds.");
  23. - sleep(30);
  24. - }
  25. -
  26. if (bMakeConf) {
  27. if (!pZNC->WriteNewConfig(sConfig)) {
  28. CZNC::DestroyInstance();
  29. @@ -337,6 +324,20 @@ int main(int argc, char** argv) {
  30. return 1;
  31. }
  32. + if (isRoot()) {
  33. + CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
  34. + CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
  35. + if (!bAllowRoot) {
  36. + CZNC::DestroyInstance();
  37. + return 1;
  38. + }
  39. + CUtils::PrintError("You have been warned.");
  40. + CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root.");
  41. + CUtils::PrintError("ZNC will start in 30 seconds.");
  42. + sleep(30);
  43. + }
  44. +
  45. +
  46. if (bForeground) {
  47. int iPid = getpid();
  48. CUtils::PrintMessage("Staying open for debugging [pid: " + CString(iPid) + "]");