Ticket #52257: patch-enable-standard-launch2.diff

File patch-enable-standard-launch2.diff, 4.8 KB (added by RJVB (René Bertin), 8 years ago)
  • configure.ac

    diff --git configure.ac configure.ac
    index 4f748ca..6b77aea 100644
    elif test x$dbus_win = xyes; then 
    18111811        # branch of the conditional because the default might conceivably
    18121812        # change (see #38201)
    18131813        DBUS_SESSION_BUS_CONNECT_ADDRESS="autolaunch:"
     1814elif test x$dbus_darwin = xyes; then
     1815        # Mac OS X autolaunching is a bit different too
     1816        # in that it relies on launchd
     1817        DBUS_SESSION_BUS_CONNECT_ADDRESS="launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET"
    18141818else
    18151819        # The default on all other Unix platforms (notably Linux)
    1816         # is to use auto-launching - this works a bit differently on Mac OS X
    1817         # but comes out basically the same in the end
     1820        # is to use auto-launching.
    18181821        DBUS_SESSION_BUS_CONNECT_ADDRESS="autolaunch:"
    18191822fi
    18201823AC_SUBST([DBUS_SESSION_BUS_CONNECT_ADDRESS])
  • dbus/dbus-server-unix.c

    diff --git dbus/dbus-server-unix.c dbus/dbus-server-unix.c
    index 92664a8..2ef949c 100644
    _dbus_server_listen_platform_specific (DBusAddressEntry *entry, 
    262262      const char *launchd_env_var = dbus_address_entry_get_value (entry, "env");
    263263      if (launchd_env_var == NULL)
    264264        {
     265#if 0
    265266          _dbus_set_bad_address (error, "launchd", "env", NULL);
    266267          return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
     268#endif
    267269        }
    268       *server_p = _dbus_server_new_for_launchd (launchd_env_var, error);
    269 
    270       if (*server_p != NULL)
    271         {
    272           _DBUS_ASSERT_ERROR_IS_CLEAR(error);
    273           return DBUS_SERVER_LISTEN_OK;
    274         }
    275       else
     270      if (launchd_env_var)
    276271        {
    277           _DBUS_ASSERT_ERROR_IS_SET(error);
    278           return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
     272          *server_p = _dbus_server_new_for_launchd (launchd_env_var, error);
     273
     274          if (*server_p != NULL)
     275            {
     276              _DBUS_ASSERT_ERROR_IS_CLEAR(error);
     277              return DBUS_SERVER_LISTEN_OK;
     278            }
     279#if 0
     280          else
     281            {
     282              _DBUS_ASSERT_ERROR_IS_SET(error);
     283              return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
     284            }
     285#endif
    279286        }
    280     }
     287      // try a hardcoded traditional address as a fallback
     288      {
     289        DBusAddressEntry **altEntry;
     290        int altLen;
     291        DBusServerListenResult retval;
     292        if (dbus_parse_address ("unix:tmpdir="DBUS_SESSION_SOCKET_DIR, &altEntry, &altLen, error) && altLen > 0)
     293          {
     294            retval = _dbus_server_listen_platform_specific (altEntry[0], server_p, error);
     295            dbus_address_entries_free (altEntry);
     296          }
     297        else
     298          {
     299            retval = DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
     300          }
     301        return retval;
     302      }
    281303#endif
     304    }
    282305  else
    283306    {
    284307      /* If we don't handle the method, we return NULL with the
  • dbus/dbus-sysdeps-unix.c

    diff --git dbus/dbus-sysdeps-unix.c dbus/dbus-sysdeps-unix.c
    index 5691c5a..4e76ca5 100644
    _dbus_lookup_session_address (dbus_bool_t *supported, 
    41304130{
    41314131#ifdef DBUS_ENABLE_LAUNCHD
    41324132  *supported = TRUE;
    4133   return _dbus_lookup_session_address_launchd (address, error);
    4134 #else
     4133  if (_dbus_lookup_session_address_launchd (address, error))
     4134    {
     4135      // success, no need to attempt anything else
     4136      return TRUE;
     4137    }
     4138// dbus can function without launchd like it does on other Unix versions, even when
     4139// it will use launchd by default (on Mac). So there is no need to disable the
     4140// non-launchd code path below.
     4141#endif
    41354142  *supported = FALSE;
    41364143
    41374144  if (!_dbus_lookup_user_bus (supported, address, error))
    41384145    return FALSE;
    4139   else if (*supported)
     4146#ifdef DBUS_ENABLE_LAUNCHD
     4147  {
     4148    const char *c = _dbus_string_get_const_data (address);
     4149    _dbus_verbose ("traditional session bus lookup yielded address \"%s\"",
     4150              c ? c : "NULL");
     4151  }
     4152#endif
     4153  if (*supported)
    41404154    return TRUE;
    41414155
    4142   /* On non-Mac Unix platforms, if the session address isn't already
     4156  /* On Unix platforms, if the session address isn't already
    41434157   * set in DBUS_SESSION_BUS_ADDRESS environment variable and the
    41444158   * $XDG_RUNTIME_DIR/bus can't be used, we punt and fall back to the
    41454159   * autolaunch: global default; see init_session_address in
    41464160   * dbus/dbus-bus.c. */
    41474161  return TRUE;
    4148 #endif
    41494162}
    41504163
    41514164/**
  • tools/dbus-launch-x11.c

    diff --git tools/dbus-launch-x11.c tools/dbus-launch-x11.c
    index a09444b..d79b4a7 100644
    x11_get_address (char **paddress, pid_t *pid, long *wid) 
    305305
    306306  /* locate the selection owner */
    307307  owner = XGetSelectionOwner (xdisplay, selection_atom);
    308   if (owner == None)
    309     return TRUE;                /* no owner */
    310308  if (wid != NULL)
    311309    *wid = (long) owner;
     310  if (owner == None)
     311    return TRUE;                /* no owner */
    312312
    313313  /* get the bus address */
    314314  result = XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False,