From facde921457877842d71139f3dd8952989874864 Mon Sep 17 00:00:00 2001 From: Robert Norris Date: Sat, 4 Mar 2017 18:59:27 +0000 Subject: dbus timeout parameter is in milliseconds. The value passed into gps_mainloop() and thuis gps_dbus_mainloop() is in microseconds. Thus to convert from microseconds to milliseconds, one needs to divide by 1000 (not multiply!). This also prevents the timeout value overflowing, when a large value timeout is passed in. NB This timeout value appears not to be actually used by current versions of dbus, see this bug: https://bugs.freedesktop.org/show_bug.cgi?id=100062 Signed-off-by: Fred Wright --- libgps_dbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libgps_dbus.c') diff --git a/libgps_dbus.c b/libgps_dbus.c index 29cd0dd0..c5cffbf1 100644 --- a/libgps_dbus.c +++ b/libgps_dbus.c @@ -134,7 +134,7 @@ int gps_dbus_mainloop(struct gps_data_t *gpsdata, share_gpsdata = gpsdata; PRIVATE(share_gpsdata)->handler = (void (*)(struct gps_data_t *))hook; for (;;) - if (dbus_connection_read_write_dispatch(connection, timeout * 1000) != TRUE) + if (dbus_connection_read_write_dispatch(connection, (int)(timeout/1000)) != TRUE) return -1; return 0; } -- cgit v1.2.1