From c18378bd01dbfa5bba0874444240abddb1ce7419 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 11 Jun 2008 16:39:48 -0400 Subject: [PATCH] Remove now-obsoleted _dbus_unix_launchd_initialize_environment --- dbus/dbus-sysdeps-unix.c | 87 ---------------------------------------------- 1 files changed, 0 insertions(+), 87 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index eff4720..a9d774c 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -3450,91 +3450,4 @@ _dbus_get_is_errno_eagain_or_ewouldblock (void) return errno == EAGAIN || errno == EWOULDBLOCK; } -#ifdef DBUS_ENABLE_LAUNCHD -/** - * Initialization for turning a launchd environment into - * DBUS_SESSION_BUS_ADDRESS - */ -void -_dbus_unix_launchd_initialize_environment (void) -{ - FILE *launchd = NULL; - const char *env_var = NULL; - char launchctl_output[DBUS_LAUNCHD_MAX_OUTPUT_LINE]; - DBusString socket_filename; - DBusString session_address; - - if (!_dbus_string_init (&socket_filename)) - { - return; - } - - if (!_dbus_string_init (&session_address)) - goto launchd_finished_0; - - /* - * Try to get the dbus session bus address - */ - env_var = _dbus_getenv("DBUS_SESSION_BUS_ADDRESS"); - - /* - * User has already overridden in the environment. - * Use that directly. - */ - if (env_var != NULL && (strlen(env_var) > 0)) - goto launchd_finished_1; - - /* - * User doesn't have the session buss address set - * so let's try to get it from launchd. - */ - env_var = _dbus_getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET"); - - if (env_var == NULL || (strlen(env_var) == 0) || access(env_var, W_OK) != 0) - { - /* - * This is a bit of a kludge but it works on both OS X Tiger & Leopard. - */ - launchd = popen("launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET", "r"); - if (launchd != NULL && !feof(launchd)) - { - if (_dbus_read(fileno(launchd), &socket_filename, DBUS_LAUNCHD_MAX_OUTPUT_LINE) > 0) - { - // strip the carriage-return - _dbus_string_shorten(&socket_filename, 1); - - env_var = _dbus_string_get_data(&socket_filename); - } - } - /* - * Make sure launchd file is closed. - */ - if (launchd != NULL) - pclose(launchd); - } - - /* - * Now that we have the session socket from launchd, set the - * DBUS_SESSION_BUS_ADDRESS environment variable. - */ - if (env_var != NULL && strlen(env_var) != 0 && access(env_var, W_OK) == 0) - { - if (!_dbus_string_append (&session_address, "unix:path=")) - goto launchd_finished_1; - - if (!_dbus_string_append (&session_address, env_var)) - goto launchd_finished_1; - - _dbus_setenv("DBUS_SESSION_BUS_ADDRESS", _dbus_string_get_const_data(&session_address)); - } - - launchd_finished_1: - _dbus_string_free(&session_address); - - launchd_finished_0: - _dbus_string_free(&socket_filename); -} -#endif - - /* tests in dbus-sysdeps-util.c */ -- 1.5.5.1