Index: trunk/extensions/PoolCounter/daemon/main.c |
— | — | @@ -17,11 +17,17 @@ |
18 | 18 | static int open_sockets = 1; /* Program will automatically close when this reaches 0 */ |
19 | 19 | |
20 | 20 | static struct event listener_ev; |
| 21 | +static char** global_argv; |
| 22 | + |
21 | 23 | int main(int argc, char** argv) { |
22 | 24 | struct event_base *base; |
23 | 25 | struct stat st; |
24 | 26 | int listener; |
25 | 27 | |
| 28 | + if ( argc >= 1 ) { |
| 29 | + global_argv = argv; |
| 30 | + } |
| 31 | + |
26 | 32 | if ( fstat( 0, &st ) || ! S_ISSOCK( st.st_mode ) ) { |
27 | 33 | close( 0 ); /* Place the listener socket in fd 0 */ |
28 | 34 | listener = listensocket( PORT ); |
— | — | @@ -177,7 +183,11 @@ |
178 | 184 | end( 0 ); |
179 | 185 | } |
180 | 186 | } else { |
181 | | - execl( "/proc/self/exe", "poolcounterd", NULL ); |
| 187 | + if ( global_argv ) { |
| 188 | + execvp( global_argv[0], global_argv ); |
| 189 | + } else { |
| 190 | + execl( "/proc/self/exe", "poolcounterd", NULL ); |
| 191 | + } |
182 | 192 | exit( 1 ); |
183 | 193 | } |
184 | 194 | } |