dbus/dbus dbus-address.c, 1.17, 1.18 dbus-sysdeps.c, 1.105,
1.106 dbus-sysdeps.h, 1.52, 1.53
John Palmieri
johnp at kemper.freedesktop.org
Thu Aug 10 13:09:45 PDT 2006
Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv14645/dbus
Modified Files:
dbus-address.c dbus-sysdeps.c dbus-sysdeps.h
Log Message:
* 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>)
Index: dbus-address.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-address.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dbus-address.c 3 Aug 2006 20:34:36 -0000 1.17
+++ dbus-address.c 10 Aug 2006 20:09:43 -0000 1.18
@@ -715,7 +715,7 @@
&entries, &len, &error))
_dbus_assert_not_reached ("could not parse address");
_dbus_assert (len == 2);
- _dbus_assert (strcmp (dbus_address_entry_get_value (entries[0], "path"), "/tmp/foo") == 0);
+ _dbus_assert (strcmp (dbus_address_entry_get_value (entries[0], "path"), strcat(_dbus_get_tmpdir(),"/foo") == 0));
_dbus_assert (strcmp (dbus_address_entry_get_value (entries[1], "name"), "test") == 0);
_dbus_assert (strcmp (dbus_address_entry_get_value (entries[1], "sliff"), "sloff") == 0);
Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- dbus-sysdeps.c 8 Aug 2006 22:08:39 -0000 1.105
+++ dbus-sysdeps.c 10 Aug 2006 20:09:43 -0000 1.106
@@ -2998,6 +2998,35 @@
+/**
+ * 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 */
Index: dbus-sysdeps.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- dbus-sysdeps.h 8 Aug 2006 22:08:39 -0000 1.52
+++ dbus-sysdeps.h 10 Aug 2006 20:09:43 -0000 1.53
@@ -323,6 +323,7 @@
dbus_bool_t _dbus_file_exists (const char *file);
dbus_bool_t _dbus_user_at_console (const char *username,
DBusError *error);
+char* _dbus_get_tmpdir();
/* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
* config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
More information about the dbus-commit
mailing list