From 0607bdb676c8fd95126ba994ab72e71becc232d8 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 1 Feb 2010 17:38:25 -0500 Subject: [PATCH 1/3] Don't crash when reloading if we haven't loaded user database yet The user database is populated on-demand, but the cache dropping code assumed it had been initialized. Simply check for NULL. https://bugs.freedesktop.org/show_bug.cgi?id=26182 --- dbus/dbus-userdb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-userdb.c b/dbus/dbus-userdb.c index 5a153c6a..bfa4c435 100644 --- a/dbus/dbus-userdb.c +++ b/dbus/dbus-userdb.c @@ -226,7 +226,8 @@ static DBusString process_homedir; static void shutdown_system_db (void *data) { - _dbus_user_database_unref (system_db); + if (system_db != NULL) + _dbus_user_database_unref (system_db); system_db = NULL; _dbus_string_free (&process_username); _dbus_string_free (&process_homedir); @@ -345,7 +346,8 @@ _dbus_user_database_flush_system (void) { _dbus_user_database_lock_system (); - _dbus_user_database_flush (system_db); + if (system_db != NULL) + _dbus_user_database_flush (system_db); _dbus_user_database_unlock_system (); } From 1c6596eb52fdf196705efe6c06dcd9fe8f836afc Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 13 Dec 2009 13:30:09 -0800 Subject: [PATCH 2/3] Use monotonic clock for _dbus_get_current_time() if it's available. _dbus_get_current_time() is used for timeouts, but uses gettimeofday(), which relies on the wall clock time, which can change. If the time is changed forwards or backwards, the timeouts are no longer valid, so the monotonic clock must be used. https://bugs.freedesktop.org/show_bug.cgi?id=25624 Signed-off-by: Colin Walters --- dbus/dbus-sysdeps-unix.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 66bcf3cb..ce3475a6 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -2036,7 +2036,8 @@ _dbus_poll (DBusPollFD *fds, } /** - * Get current time, as in gettimeofday(). + * Get current time, as in gettimeofday(). Use the monotonic clock if + * available, to avoid problems when the system time changes. * * @param tv_sec return location for number of seconds * @param tv_usec return location for number of microseconds (thousandths) @@ -2047,12 +2048,22 @@ _dbus_get_current_time (long *tv_sec, { struct timeval t; +#ifdef HAVE_MONOTONIC_CLOCK + struct timespec ts; + clock_gettime (CLOCK_MONOTONIC, &ts); + + if (tv_sec) + *tv_sec = ts.tv_sec; + if (tv_usec) + *tv_usec = ts.tv_nsec / 1000; +#else gettimeofday (&t, NULL); if (tv_sec) *tv_sec = t.tv_sec; if (tv_usec) *tv_usec = t.tv_usec; +#endif } /** From a7169e694c48c1259b51f62d73e92292d11bbab2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 2 Feb 2010 10:31:28 -0500 Subject: [PATCH 3/3] Release 1.2.18 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index cb16eec4..3c8626ec 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_PREREQ(2.52) m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [2]) -m4_define([dbus_micro_version], [16]) +m4_define([dbus_micro_version], [18]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT(dbus, [dbus_version])