From: Marc Fournier Date: Sat, 21 Nov 2015 10:16:05 +0000 (+0100) Subject: gps: make plugin compatible with older libgps versions X-Git-Tag: collectd-5.6.0~73^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5579b15071314752b053daa03ff62354809364e4;p=collectd.git gps: make plugin compatible with older libgps versions --- diff --git a/src/gps.c b/src/gps.c index 944932ab..d0937c98 100644 --- a/src/gps.c +++ b/src/gps.c @@ -74,7 +74,11 @@ static void * cgps_thread (void * pData) { err_count = 0; +#if GPSD_API_MAJOR_VERSION > 4 int status = gps_open (config.host, config.port, &conn); +#else + int status = gps_open_r (config.host, config.port, &conn); +#endif if (status < 0) { WARNING ("gps plugin: Connecting to %s:%s failed: %s", @@ -88,8 +92,12 @@ static void * cgps_thread (void * pData) while (1) { +#if GPSD_API_MAJOR_VERSION > 4 long timeout_ms = CDTIME_T_TO_MS (config.timeout); if (!gps_waiting (&conn, (int) timeout_ms)) +#else + if (!gps_waiting (&conn)) +#endif { struct timespec pause_ns; CDTIME_T_TO_TIMESPEC (config.pause, &pause_ns);