Port osiris to -ng
[openwrt/svn-archive/archive.git] / admin / osiris / patches / 02-osirisd-pidfile.patch
1 --- osiris-4.1.8-orig/src/osirisd/osirisd.c 2005-04-14 01:00:55.000000000 +0200
2 +++ osiris-4.1.8-1/src/osirisd/osirisd.c 2005-04-22 23:11:32.000000000 +0200
3 @@ -218,6 +218,8 @@
4
5 #ifdef USE_PRIVSEP
6 rootpriv_setup_pidfile();
7 +#else
8 + setup_pidfile();
9 #endif
10
11 process();
12 --- osiris-4.1.8-orig/src/osirisd/rootpriv.c 2005-04-14 00:55:59.000000000 +0200
13 +++ osiris-4.1.8-1/src/osirisd/rootpriv.c 2005-04-22 23:25:10.000000000 +0200
14 @@ -35,6 +35,10 @@
15 #include "logging.h"
16 #include "rootpriv.h"
17
18 +#ifndef WIN32
19 +extern char pid_file[MAX_PATH_LENGTH];
20 +#endif
21 +
22 #ifdef USE_PRIVSEP
23
24 /* this is defined in regex, and sometimes conflicts with stuff */
25 @@ -80,10 +84,6 @@
26 extern pid_t child_pid;
27 extern int rootpriv_pipe[2]; /* socketpair used for rootpriv comm. */
28
29 -#ifndef WIN32
30 -extern char pid_file[MAX_PATH_LENGTH];
31 -#endif
32 -
33 #define INCOMING_ROOT_REQUEST() ( FD_ISSET( rootpriv_pipe[1], &root_read_set ) )
34
35
36 @@ -292,17 +292,6 @@
37 #endif
38 }
39
40 -void setup_pidfile()
41 -{
42 - FILE *pidfile = fopen( pid_file, "wb" );
43 -
44 - if( pidfile != NULL )
45 - {
46 - fprintf( pidfile, "%ld\n", (long)getpid() );
47 - fclose( pidfile );
48 - }
49 -}
50 -
51 void handle_signals()
52 {
53 pid_t pid;
54 @@ -789,3 +778,14 @@
55
56 #endif /* USE_PRIVSEP */
57
58 +void setup_pidfile()
59 +{
60 + FILE *pidfile = fopen( pid_file, "wb" );
61 +
62 + if( pidfile != NULL )
63 + {
64 + fprintf( pidfile, "%ld\n", (long)getpid() );
65 + fclose( pidfile );
66 + }
67 +}
68 +