Merge "[lib-fix] Fixed return value of kdbus_write_msg Change-Id: Ia3a45a6a79b4078929...
[platform/upstream/dbus.git] / bus / activation-helper.c
index ab9d601..e3b3323 100644 (file)
@@ -40,6 +40,7 @@
 #include <pwd.h>
 #include <grp.h>
 
+#include <dbus/dbus-misc.h>
 #include <dbus/dbus-shell.h>
 #include <dbus/dbus-marshal-validate.h>
 
@@ -140,21 +141,12 @@ out_all:
   return desktop_file;
 }
 
-/* Cleares the environment, except for DBUS_VERBOSE and 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;
-#ifdef DBUS_ENABLE_VERBOSE_MODE
-  const char *debug_env = NULL;
-
-  /* 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 ())
@@ -163,21 +155,12 @@ clear_environment (DBusError *error)
                       "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);
+  /* 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
 
-  /* 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;
 }