#include <pwd.h>
#include <grp.h>
+#include <dbus/dbus-misc.h>
#include <dbus/dbus-shell.h>
#include <dbus/dbus-marshal-validate.h>
return desktop_file;
}
-/* Clears the environment, except for DBUS_STARTER_x */
+/* Clears the environment, except for DBUS_STARTER_x,
+ * which we hardcode to the system bus.
+ */
static dbus_bool_t
clear_environment (DBusError *error)
{
- const char *starter_env = NULL;
-
- /* we save the starter */
- starter_env = _dbus_getenv ("DBUS_STARTER_ADDRESS");
-
#ifndef ACTIVATION_LAUNCHER_TEST
/* totally clear the environment */
if (!_dbus_clearenv ())
"could not clear environment\n");
return FALSE;
}
-#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");
+ /* 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;
}