branch Attitude Adjustment packages
[12.09/packages.git] / net / znc / patches / 001-move_rootcheck_after_config.patch
1 From 5f655f9a25a377c01cb15517859eb514628a43d4 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 ---
7  main.cpp |   27 ++++++++++++++-------------
8  1 files changed, 14 insertions(+), 13 deletions(-)
9
10 --- a/main.cpp
11 +++ b/main.cpp
12 @@ -211,19 +211,6 @@ int main(int argc, char** argv) {
13         }
14  #endif
15  
16 -       if (isRoot()) {
17 -               CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
18 -               CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
19 -               if (!bAllowRoot) {
20 -                       delete pZNC;
21 -                       return 1;
22 -               }
23 -               CUtils::PrintError("You have been warned.");
24 -               CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root.");
25 -               CUtils::PrintError("ZNC will start in 30 seconds.");
26 -               sleep(30);
27 -       }
28 -
29         if (bMakeConf) {
30                 if (!pZNC->WriteNewConfig(sConfig)) {
31                         delete pZNC;
32 @@ -244,6 +231,20 @@ int main(int argc, char** argv) {
33                 return 1;
34         }
35  
36 +       if (isRoot()) {
37 +               CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
38 +               CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
39 +               if (!bAllowRoot) {
40 +                       delete pZNC;
41 +                       return 1;
42 +               }
43 +               CUtils::PrintError("You have been warned.");
44 +               CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root.");
45 +               CUtils::PrintError("ZNC will start in 30 seconds.");
46 +               sleep(30);
47 +       }
48 +
49 +
50         if (bForeground) {
51                 int iPid = getpid();
52                 CUtils::PrintMessage("Staying open for debugging [pid: " + CString(iPid) + "]");