From 4fdbb0ecdb72ec4d958ea212cd6453814e15a2d5 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 15 Oct 2010 08:15:02 +0200 Subject: [PATCH] Allow daemonizing FWP manager --- fwp/mngr/fwp_mngr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fwp/mngr/fwp_mngr.c b/fwp/mngr/fwp_mngr.c index aa2d850..233215d 100644 --- a/fwp/mngr/fwp_mngr.c +++ b/fwp/mngr/fwp_mngr.c @@ -123,13 +123,19 @@ int main(int argc, char *argv[]) int ret; forb_init_attr_t attr = { .orb_id = "org.frescor.frm.fwp" }; int opt; + bool opt_daemon = false; + char *opt_pidfile = NULL; if (getenv("FWP_BYPASS")) priv.bypass = true; - while ((opt = getopt_long(argc, argv, "b:l:os", &long_opts[0], NULL)) != EOF) { + while ((opt = getopt_long(argc, argv, "b:l:hos", &long_opts[0], NULL)) != EOF) { switch (opt) { + case 'd': + opt_daemon = true; + opt_pidfile = optarg; + break; case 'l': ul_log_domain_arg2levels(optarg); break; @@ -149,6 +155,9 @@ int main(int argc, char *argv[]) } } + if (opt_daemon) + forb_daemon_prepare(opt_pidfile); + orb = forb_init(&argc, &argv, &attr); if (!orb) error(1, errno, "forb_init"); -- 2.39.2