mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-04 10:40:47 +01:00
* 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>)
This commit is contained in:
parent
5628ef82de
commit
2974c82428
6 changed files with 48 additions and 4 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2006-08-10 John (J5) Palmieri <johnp@redhat.com>
|
||||
|
||||
* 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>)
|
||||
|
||||
2006-08-09 John (J5) Palmieri <johnp@redhat.com>
|
||||
|
||||
* dbus/dbus-dataslot.c (_dbus_data_slot_allocator_alloc):
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <dbus/dbus-shell.h>
|
||||
#include <dbus/dbus-spawn.h>
|
||||
#include <dbus/dbus-timeout.h>
|
||||
#include <dbus/dbus-sysdeps.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
@ -1918,8 +1919,11 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
|
|||
|
||||
if (!_dbus_string_init (&directory))
|
||||
return FALSE;
|
||||
|
||||
if (!_dbus_string_append (&directory, "/tmp/dbus-reload-test-") ||
|
||||
|
||||
if (!_dbus_string_append (&directory, _dbus_get_tmpdir()))
|
||||
return FALSE;
|
||||
|
||||
if (!_dbus_string_append (&directory, "/dbus-reload-test-") ||
|
||||
!_dbus_generate_random_ascii (&directory, 6))
|
||||
{
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ _dbus_address_test (void)
|
|||
&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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -323,6 +323,7 @@ void _dbus_set_signal_handler (int sig,
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <dbus/dbus-memory.h>
|
||||
#include <dbus/dbus-shell.h>
|
||||
#include <dbus/dbus-string.h>
|
||||
#include <dbus/dbus-sysdeps.h>
|
||||
|
||||
static dbus_bool_t
|
||||
test_command_line (const char *arg1, ...)
|
||||
|
|
@ -95,7 +96,7 @@ main (int argc, char **argv)
|
|||
|| !test_command_line ("/opt/gnome/bin/service-start", NULL)
|
||||
|| !test_command_line ("grep", "-l", "-r", "-i", "'whatever'", "files*.c", NULL)
|
||||
|| !test_command_line ("/home/boston/johnp/devel-local/dbus/test/test-segfault", NULL)
|
||||
|| !test_command_line ("ls", "-l", "-a", "--colors", "/tmp", NULL)
|
||||
|| !test_command_line ("ls", "-l", "-a", "--colors", _dbus_get_tmpdir(), NULL)
|
||||
|| !test_command_line ("rsync-to-server", NULL)
|
||||
|| !test_command_line ("test-segfault", "--no-segfault", NULL)
|
||||
|| !test_command_line ("evolution", "mailto:pepe@cuco.com", NULL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue