diff options
author | Milan Bouchet-Valat <nalimilan@club.fr> | 2009-09-14 21:40:53 +0200 |
---|---|---|
committer | Milan Bouchet-Valat <nalimilan@club.fr> | 2009-09-15 16:20:07 +0200 |
commit | 8858c19b2447ca6e3abb8f3e3f0e5c04a7344a54 (patch) | |
tree | 910afa944755d0e50453277327d624898805bd83 | |
parent | e53a476e4c05ad87611dbb5e28d6df1c81ed623e (diff) |
Don't daemonize by default
D-Bus activation can return an error if we daemonize, so we should not do this be default, and let D-Bus daemonize the dispatcher. Thus, add a -D option to force this behavior if needed, and make -n a no-op. In the process, the commit removes the handling of the old STB_NO_DAEMON envvar, which has become useless. This fixes https://bugs.launchpad.net/bugs/411533. See also an explanation at https://bugzilla.gnome.org/show_bug.cgi?id=583356.
-rw-r--r-- | dispatcher/main.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dispatcher/main.c b/dispatcher/main.c index e4318bc..1b52182 100644 --- a/dispatcher/main.c +++ b/dispatcher/main.c @@ -88,12 +88,15 @@ main (int argc, char *argv[]) { GMainLoop *main_loop; gboolean debug = FALSE; - gboolean no_daemon = FALSE; + gboolean daemon = FALSE; GOptionContext *context; GOptionEntry entries[] = { { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, "Debug mode", NULL }, - { "no-daemon", 'n', 0, G_OPTION_ARG_NONE, &no_daemon, "No daemon mode", NULL }, + { "daemon", 'D', 0, G_OPTION_ARG_NONE, &daemon, "Daemon mode", NULL }, + /* Option kept for backward compatibility */ + { "no-daemon", 'n', G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_REVERSE, + G_OPTION_ARG_NONE, &daemon, "No daemon mode (default)", NULL }, { NULL } }; @@ -105,8 +108,7 @@ main (int argc, char *argv[]) g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); - /* keep the envvar for backwards compat */ - if (!no_daemon && !getenv ("STB_NO_DAEMON")) + if (daemon) daemonize (); signal (SIGTERM, signal_received); |