diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2006-08-10 20:09:43 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2006-08-10 20:09:43 +0000 |
commit | 2974c82428b5d9d3e1f504ba4052aec47fc2b415 (patch) | |
tree | 66973e6b07b52fcd01add8cdfb4c6e1bdac5fae0 /dbus/dbus-sysdeps.c | |
parent | 5628ef82de9e853381ab61bab8c3cd3b1b622290 (diff) |
* dbus/dbus-sysdeps.c:
* dbus/dbus-address.c:
* bus/activation.c:
* test/shell-test.c:
don't hardcode tmp directory (patch from Dave Meikle
<dmk at davemeikle dot co dot uk>)
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r-- | dbus/dbus-sysdeps.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 9a2c1fde..43bfcd8c 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -2998,6 +2998,35 @@ int _dbus_printf_string_upper_bound (const char *format, +/** + * Gets the temporary files directory by inspecting the environment variables + * TMPDIR, TMP, and TEMP in that order. If none of those are set "/tmp" is returned + * + * @returns char* - location of temp directory + */ +char* +_dbus_get_tmpdir() +{ + char* tmpdir; + + tmpdir = getenv("TMPDIR"); + if (tmpdir) { + return tmpdir; + } + + tmpdir = getenv("TMP"); + if (tmpdir) { + return tmpdir; + } + + tmpdir = getenv("TEMP"); + if (tmpdir) { + return tmpdir; + } + + return "/tmp"; +} + /** @} end of sysdeps */ /* tests in dbus-sysdeps-util.c */ |