summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-06-05 19:58:22 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-08-23 11:40:50 +0100
commit412538b3b9fb424c3af313815c3928a9ec221ad7 (patch)
treee459e1ced2ed8444a2a15f160e5ce239e20718bf /dbus/dbus-sysdeps.c
parent30fa2e1ace062314e9624b29239c2c7e9519e6c2 (diff)
downloaddbus-412538b3b9fb424c3af313815c3928a9ec221ad7.tar.gz
Export dbus_setenv() as a utility function
It's sufficiently portable that GLib has an equivalent, and I really don't want to have to either open-code it in dbus-run-session or link dbus-run-session statically. We have enough statically-linked rubbish already. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196 Reviewed-by: Colin Walters <walters@verbum.org>
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r--dbus/dbus-sysdeps.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index 0fbf9e71..de3a18cb 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -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.
@@ -92,6 +93,8 @@ _dbus_abort (void)
}
/**
+ * @ingroup DBusMisc
+ *
* Wrapper for setenv(). If the value is #NULL, unsets
* the environment variable.
*
@@ -100,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);