1
0

100-move_rootcheck_after_config.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. @@ -304,19 +304,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. @@ -338,6 +325,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) + "]");