From: Baruch Siach Date: Tue, 9 Oct 2018 16:57:21 +0000 (+0300) Subject: gps plugin: fix build with newer gpsd X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=991a6d3fd38c2435d94de3853fda36b3330cf6ab;p=collectd.git gps plugin: fix build with newer gpsd gpsd version 3.18 changed the prototype of gps_read(). Make the gps_read() call depend on GPSD_API_MAJOR_VERSION to fix that. This fixes build failures like: gps.c: In function 'cgps_thread': gps.c:144:11: error: too few arguments to function 'gps_read' if (gps_read(&gpsd_conn) == -1) { ^~~~~~~~ --- diff --git a/src/gps.c b/src/gps.c index 1d32d049..b22c3a2e 100644 --- a/src/gps.c +++ b/src/gps.c @@ -141,7 +141,12 @@ static void *cgps_thread(void *pData) { continue; } - if (gps_read(&gpsd_conn) == -1) { +#if GPSD_API_MAJOR_VERSION > 6 + if (gps_read(&gpsd_conn, NULL, 0) == -1) +#else + if (gps_read(&gpsd_conn) == -1) +#endif + { WARNING("gps plugin: incorrect data! (err_count: %d)", err_count); err_count++;