char buf[1024];
int bufsize;
int len;
+ va_list args_copy;
bufsize = sizeof (buf);
- len = _vsnprintf (buf, bufsize - 1, format, args);
+ DBUS_VA_COPY (args_copy, args);
+ len = _vsnprintf (buf, bufsize - 1, format, args_copy);
+ va_end (args_copy);
while (len == -1) /* try again */
{
if (p == NULL)
return -1;
- len = _vsnprintf (p, bufsize - 1, format, args);
+ DBUS_VA_COPY (args_copy, args);
+ len = _vsnprintf (p, bufsize - 1, format, args_copy);
+ va_end (args_copy);
free (p);
}
* Creates a full-duplex pipe (as in socketpair()).
* Sets both ends of the pipe nonblocking.
*
- * @todo libdbus only uses this for the debug-pipe server, so in
- * principle it could be in dbus-sysdeps-util.c, except that
- * dbus-sysdeps-util.c isn't in libdbus when tests are enabled and the
- * debug-pipe server is used.
- *
* @param fd1 return location for one end
* @param fd2 return location for the other end
* @param blocking #TRUE if pipe should be blocking
/**
- * Get current time, as in gettimeofday().
+ * Get current time, as in gettimeofday(). Never uses the monotonic
+ * clock.
*
* @param tv_sec return location for number of seconds
* @param tv_usec return location for number of microseconds
*/
void
-_dbus_get_current_time (long *tv_sec,
- long *tv_usec)
+_dbus_get_real_time (long *tv_sec,
+ long *tv_usec)
{
FILETIME ft;
dbus_uint64_t time64;
*tv_usec = time64 % 1000000;
}
+/**
+ * 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
+ */
+void
+_dbus_get_monotonic_time (long *tv_sec,
+ long *tv_usec)
+{
+ /* no implementation yet, fall back to wall-clock time */
+ _dbus_get_real_time (tv_sec, tv_usec);
+}
/**
* signal (SIGPIPE, SIG_IGN);
if (!SearchPathA(NULL, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
{
- printf ("please add the path to %s to your PATH environment variable\n", daemon_name);
- printf ("or start the daemon manually\n\n");
- goto out;
+ // Look in directory containing dbus shared library
+ HMODULE hmod;
+ char dbus_module_path[MAX_PATH];
+ DWORD rc;
+
+ _dbus_verbose( "did not found dbus daemon executable on default search path, "
+ "trying path where dbus shared library is located");
+
+ hmod = _dbus_win_get_dll_hmodule();
+ rc = GetModuleFileNameA(hmod, dbus_module_path, sizeof(dbus_module_path));
+ if (rc <= 0)
+ {
+ dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not retrieve dbus shared library file name");
+ retval = FALSE;
+ goto out;
+ }
+ else
+ {
+ char *ext_idx = strrchr(dbus_module_path, '\\');
+ if (ext_idx)
+ *ext_idx = '\0';
+ if (!SearchPathA(dbus_module_path, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
+ {
+ dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not find dbus-daemon executable");
+ retval = FALSE;
+ printf ("please add the path to %s to your PATH environment variable\n", daemon_name);
+ printf ("or start the daemon manually\n\n");
+ goto out;
+ }
+ _dbus_verbose( "found dbus daemon executable at %s",dbus_module_path);
+ }
}
+
// Create process
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
return FALSE;
}
+dbus_bool_t
+_dbus_check_setuid (void)
+{
+ return FALSE;
+}
+
/** @} end of sysdeps-win */
/* tests in dbus-sysdeps-util.c */