summaryrefslogtreecommitdiff
path: root/net/znc/patches/001-move_rootcheck_after_config.patch
blob: 8b3e3e703780e67eb7885f400bb6e60a5d4d2bbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 5f655f9a25a377c01cb15517859eb514628a43d4 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
Date: Wed, 6 Apr 2011 04:10:23 +0200
Subject: [PATCH] Move the root check to after config parsing

---
 src/main.cpp |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

--- a/src/main.cpp
+++ b/src/main.cpp
@@ -243,19 +243,6 @@ int main(int argc, char** argv) {
 		CUtils::PrintStatus(true, "");
 	}
 
-	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;
@@ -276,6 +263,20 @@ 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) + "]");