summaryrefslogtreecommitdiffstats
path: root/openwrt/package/osiris/patches/osirisd-pidfile.patch
blob: 80c52dbf1a7b51605b75b62d980d181c8042c90c (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
62
63
64
65
66
67
68
--- osiris-4.1.8-orig/src/osirisd/osirisd.c	2005-04-14 01:00:55.000000000 +0200
+++ osiris-4.1.8-1/src/osirisd/osirisd.c	2005-04-22 23:11:32.000000000 +0200
@@ -218,6 +218,8 @@
 
 #ifdef USE_PRIVSEP
     rootpriv_setup_pidfile();
+#else
+    setup_pidfile();
 #endif
 
     process();
--- osiris-4.1.8-orig/src/osirisd/rootpriv.c	2005-04-14 00:55:59.000000000 +0200
+++ osiris-4.1.8-1/src/osirisd/rootpriv.c	2005-04-22 23:25:10.000000000 +0200
@@ -35,6 +35,10 @@
 #include "logging.h"
 #include "rootpriv.h"
 
+#ifndef WIN32
+extern char pid_file[MAX_PATH_LENGTH];
+#endif
+
 #ifdef USE_PRIVSEP
 
 /* this is defined in regex, and sometimes conflicts with stuff */
@@ -80,10 +84,6 @@
 extern pid_t child_pid;
 extern int rootpriv_pipe[2];      /* socketpair used for rootpriv comm.  */
 
-#ifndef WIN32
-extern char pid_file[MAX_PATH_LENGTH];
-#endif
-
 #define INCOMING_ROOT_REQUEST() ( FD_ISSET( rootpriv_pipe[1], &root_read_set ) )
 
 
@@ -292,17 +292,6 @@
 #endif
 }
 
-void setup_pidfile()
-{
-    FILE *pidfile = fopen( pid_file, "wb" );
-
-    if( pidfile != NULL )
-    {
-        fprintf( pidfile, "%ld\n", (long)getpid() );
-        fclose( pidfile );
-    }
-}
-
 void handle_signals()
 {
     pid_t pid;
@@ -789,3 +778,14 @@
 
 #endif /* USE_PRIVSEP */
 
+void setup_pidfile()
+{
+    FILE *pidfile = fopen( pid_file, "wb" );
+
+    if( pidfile != NULL )
+    {
+        fprintf( pidfile, "%ld\n", (long)getpid() );
+        fclose( pidfile );
+    }
+}
+