Commit f2d8d93b authored by Geoff Simmons's avatar Geoff Simmons

support -D option (daemonization)

parent b5718f17
...@@ -415,9 +415,8 @@ usage(void) ...@@ -415,9 +415,8 @@ usage(void)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int c, errnum, status, a_flag = 0, v_flag = 0, d_flag = 0; int c, errnum, status, a_flag = 0, v_flag = 0, d_flag = 0, D_flag = 0;
#if 0 #if 0
int D_flag = 0;
const char *P_arg = NULL; const char *P_arg = NULL;
#endif #endif
char *w_arg = NULL, *q_arg = NULL, *g_arg = NULL; char *w_arg = NULL, *q_arg = NULL, *g_arg = NULL;
...@@ -447,10 +446,15 @@ main(int argc, char *argv[]) ...@@ -447,10 +446,15 @@ main(int argc, char *argv[])
case 'F': case 'F':
strcpy(config.cformat, optarg); strcpy(config.cformat, optarg);
break; break;
#if 0
case 'D': case 'D':
#ifdef HAVE_DAEMON
D_flag = 1; D_flag = 1;
#else
fprintf(stderr, "-D not supported");
exit(EXIT_FAILURE);
#endif
break; break;
#if 0
case 'P': case 'P':
P_arg = optarg; P_arg = optarg;
break; break;
...@@ -502,14 +506,18 @@ main(int argc, char *argv[]) ...@@ -502,14 +506,18 @@ main(int argc, char *argv[])
perror(P_arg); perror(P_arg);
exit(1); exit(1);
} }
#endif
if (D_flag && varnish_daemon(0, 0) == -1) { #ifdef HAVE_DAEMON
if (D_flag && daemon(0, 0) == -1) {
perror("daemon()"); perror("daemon()");
#if 0
if (pfh != NULL) if (pfh != NULL)
VPF_Remove(pfh); VPF_Remove(pfh);
#endif
exit(1); exit(1);
} }
#endif #endif
if (LOG_Open(config.syslog_ident) != 0) { if (LOG_Open(config.syslog_ident) != 0) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment