diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2010-01-09 11:55:15 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2010-01-09 12:43:05 +0200 |
commit | f1d1447e104c4f609c0e8c528b56ea6afa540b95 (patch) | |
tree | 6c4d286e496674e3dafa18aa6e5b8395a3d28a3b /src/daemon | |
parent | 25435bf373cd928dbf269e86810eb23b0ac0d7ee (diff) |
daemon: Don't autospawn if a server address is explicitly configured.
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/main.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c index e65683645..5ccda779e 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -63,6 +63,10 @@ #include <dbus/dbus.h> #endif +#include <pulse/client-conf.h> +#ifdef HAVE_X11 +#include <pulse/client-conf-x11.h> +#endif #include <pulse/mainloop.h> #include <pulse/mainloop-signal.h> #include <pulse/timeval.h> @@ -343,6 +347,24 @@ static void set_all_rlimits(const pa_daemon_conf *conf) { } #endif +static char *check_configured_address(void) { + char *default_server = NULL; + pa_client_conf *c = pa_client_conf_new(); + + pa_client_conf_load(c, NULL); +#ifdef HAVE_X11 + pa_client_conf_from_x11(c, NULL); +#endif + pa_client_conf_env(c); + + if (c->default_server && *c->default_server) + default_server = pa_xstrdup(c->default_server); + + pa_client_conf_free(c); + + return default_server; +} + #ifdef HAVE_DBUS static pa_dbus_connection *register_dbus_name(pa_core *c, DBusBusType bus, const char* name) { DBusError error; @@ -383,6 +405,7 @@ int main(int argc, char *argv[]) { pa_daemon_conf *conf = NULL; pa_mainloop *mainloop = NULL; char *s; + char *configured_address; int r = 0, retval = 1, d = 0; pa_bool_t valid_pid_file = FALSE; pa_bool_t ltdl_init = FALSE; @@ -649,6 +672,13 @@ int main(int argc, char *argv[]) { goto finish; } + if (conf->cmd == PA_CMD_START && (configured_address = check_configured_address())) { + pa_log_notice(_("User-configured server at %s, not autospawning."), configured_address); + pa_xfree(configured_address); + retval = 0; + goto finish; + } + if (conf->system_instance && !conf->disallow_exit) pa_log_warn(_("Running in system mode, but --disallow-exit not set!")); |