[daemon-fix] Fixed sending daemon match rules for kdbus broadcasts
[platform/upstream/dbus.git] / dbus / dbus-sysdeps.c
index 976c7e4..de3a18c 100644 (file)
@@ -29,6 +29,7 @@
 #include "dbus-protocol.h"
 #include "dbus-string.h"
 #include "dbus-list.h"
+#include "dbus-misc.h"
 
 /* NOTE: If you include any unix/windows-specific headers here, you are probably doing something
  * wrong and should be putting some code in dbus-sysdeps-unix.c or dbus-sysdeps-win.c.
 #include <errno.h>
 #endif
 
-_DBUS_DEFINE_GLOBAL_LOCK (win_fds);
-_DBUS_DEFINE_GLOBAL_LOCK (sid_atom_cache);
-_DBUS_DEFINE_GLOBAL_LOCK (system_users);
-
 #ifdef DBUS_WIN
   #include <stdlib.h>
 #elif (defined __APPLE__)
@@ -96,6 +93,8 @@ _dbus_abort (void)
 }
 
 /**
+ * @ingroup DBusMisc
+ *
  * Wrapper for setenv(). If the value is #NULL, unsets
  * the environment variable.
  *
@@ -104,13 +103,16 @@ _dbus_abort (void)
  * we can not rely on internal implementation details of
  * the underlying libc library.
  *
+ * This function is not thread-safe, because altering the environment
+ * in Unix is not thread-safe in general.
+ *
  * @param varname name of environment variable
- * @param value value of environment variable
- * @returns #TRUE on success.
+ * @param value value of environment variable, or #NULL to unset
+ * @returns #TRUE on success, #FALSE if not enough memory.
  */
 dbus_bool_t
-_dbus_setenv (const char *varname,
-              const char *value)
+dbus_setenv (const char *varname,
+             const char *value)
 {
   _dbus_assert (varname != NULL);
   
@@ -182,18 +184,12 @@ _dbus_setenv (const char *varname,
 const char*
 _dbus_getenv (const char *varname)
 {  
-#if defined(HAVE_SECURE_GETENV)
-  return secure_getenv (varname);
-#elif defined(HAVE___SECURE_GETENV)
-  return __secure_getenv (varname);
-#else
   /* Don't respect any environment variables if the current process is
    * setuid.  This is the equivalent of glibc's __secure_getenv().
    */
   if (_dbus_check_setuid ())
     return NULL;
   return getenv (varname);
-#endif
 }
 
 /**