예제 #1
0
/* Clears the environment, except for DBUS_STARTER_x,
 * which we hardcode to the system bus.
 */
static dbus_bool_t
clear_environment (DBusError *error)
{
#ifndef ACTIVATION_LAUNCHER_TEST
  /* totally clear the environment */
  if (!_dbus_clearenv ())
    {
      dbus_set_error (error, DBUS_ERROR_SPAWN_SETUP_FAILED,
                      "could not clear environment\n");
      return FALSE;
    }

  /* Ensure the bus is set to system */
  dbus_setenv ("DBUS_STARTER_ADDRESS", DBUS_SYSTEM_BUS_DEFAULT_ADDRESS);
  dbus_setenv ("DBUS_STARTER_BUS_TYPE", "system");
#endif

  return TRUE;
}
예제 #2
0
/* Cleares the environment, except for DBUS_VERBOSE and DBUS_STARTER_x */
static dbus_bool_t
clear_environment (DBusError *error)
{
    const char *debug_env = NULL;
    const char *starter_env = NULL;

#ifdef DBUS_ENABLE_VERBOSE_MODE
    /* are we debugging */
    debug_env = _dbus_getenv ("DBUS_VERBOSE");
#endif

    /* we save the starter */
    starter_env = _dbus_getenv ("DBUS_STARTER_ADDRESS");

#ifndef ACTIVATION_LAUNCHER_TEST
    /* totally clear the environment */
    if (!_dbus_clearenv ())
    {
        dbus_set_error (error, DBUS_ERROR_SPAWN_SETUP_FAILED,
                        "could not clear environment\n");
        return FALSE;
    }
#endif

#ifdef DBUS_ENABLE_VERBOSE_MODE
    /* restore the debugging environment setting if set */
    if (debug_env)
        _dbus_setenv ("DBUS_VERBOSE", debug_env);
#endif

    /* restore the starter */
    if (starter_env)
        _dbus_setenv ("DBUS_STARTER_ADDRESS", starter_env);

    /* set the type, which must be system if we got this far */
    _dbus_setenv ("DBUS_STARTER_BUS_TYPE", "system");

    return TRUE;
}