summaryrefslogtreecommitdiff
path: root/community/aiccu/02-allow-tunnels.patch
blob: ec1c1dade245d513f9e3fbbb8c5a82fc41817aa2 (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
53
54
55
56
57
58
59
60
61
commit d7c4f7c0d34b80c188fa45228ca282fd8771a41d
Author: Norman Rasmussen <norman@rasmussen.co.za>
Date:   Sun Jan 10 21:45:55 2010 +0000

    Allow 'tunnels' mode when there's an already running instance.

diff --git a/unix-console/main.c b/unix-console/main.c
index 8a4d9a9..388d988 100755
--- a/unix-console/main.c
+++ b/unix-console/main.c
@@ -50,7 +50,7 @@ int sigrunning(int sig)
 	/* Close the file again */
 	fclose(f);
 
-	/* If we can HUP it, it still runs */
+	/* If we can signal it, it still runs */
 	return (pid > 0 && kill(pid, sig) == 0 ? 1 : 0);
 }
 
@@ -302,20 +302,6 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
-#ifndef _WIN32
-	/* start or stop? */
-	if (	mode != A_TEST &&
-		mode != A_AUTOTEST)
-	{
-		/* Already running? */
-		if (sigrunning(mode == A_STOP ? SIGTERM : 0) == 1)
-		{
-			dolog(LOG_ERR, "Already running instance HUP'ed, exiting\n");
-			return 0;
-		}
-	}
-#endif
-
 	/* Verify required parameters */
 	if (!g_aiccu->username || !g_aiccu->password)
 	{
@@ -331,6 +317,20 @@ int main(int argc, char *argv[])
 		return ret == 0 ? -1 : 0;
 	}
 
+#ifndef _WIN32
+	/* start or stop? */
+	if (	mode != A_TEST &&
+		mode != A_AUTOTEST)
+	{
+		/* Already running? */
+		if (sigrunning(mode == A_STOP ? SIGTERM : 0) == 1)
+		{
+			dolog(LOG_ERR, "Already running instance signaled, exiting\n");
+			return 0;
+		}
+	}
+#endif
+
 	/* Get our tunnel */
 	hTunnel = get_tunnel();