Merge pull request #4825 from nxhack/node-hid_fix_depends
[feed/packages.git] / net / htpdate / patches / 101-daemon-run-in-foreground.patch
1 --- a/htpdate.c
2 +++ b/htpdate.c
3 @@ -395,6 +395,7 @@ Usage: htpdate [-046abdhlqstxD] [-i pid
4 -b burst mode\n\
5 -d debug mode\n\
6 -D daemon mode\n\
7 + -f run in foreground\n\
8 -h help\n\
9 -i pid file\n\
10 -l use syslog for output\n\
11 @@ -510,7 +511,7 @@ int main( int argc, char *argv[] ) {
12
13
14 /* Parse the command line switches and arguments */
15 - while ( (param = getopt(argc, argv, "046abdhi:lm:p:qstu:xDM:P:") ) != -1)
16 + while ( (param = getopt(argc, argv, "046abdhi:lm:p:qstu:xDfM:P:") ) != -1)
17 switch( param ) {
18
19 case '0': /* HTTP/1.0 */
20 @@ -593,6 +594,9 @@ int main( int argc, char *argv[] ) {
21 daemonize = 1;
22 logmode = 1;
23 break;
24 + case 'f': /* run in foreground */
25 + daemonize = 2;
26 + break;
27 case 'M': /* maximum poll interval */
28 if ( ( maxsleep = atoi(optarg) ) <= 0 ) {
29 fputs( "Invalid sleep time\n", stderr );
30 @@ -631,7 +635,9 @@ int main( int argc, char *argv[] ) {
31
32 /* Run as a daemonize when -D is set */
33 if ( daemonize ) {
34 - runasdaemon( pidfile );
35 + if ( daemonize == 1 ) {
36 + runasdaemon( pidfile );
37 + }
38 /* Query only mode doesn't exist in daemon mode */
39 if ( !setmode )
40 setmode = 1;