I was boggled by this because fds are ints.

Reading the header, this seems crazy: it's either an int or a void*.
Compilers may well warn on casting void * to long, as that's basically
wrong.


Two separate thoughts towards sanity:

  If it's ever going to be a pointer, it should always be a pointer.
  So instead of just int, it should be a pointer to a struct with a fd.

  Instead of open-coding the type in printf, define PRI_GPSD_FD as
  either %p or %d and then use that in printf.



commit 84ff116f48ec9ea50832c053c74592ac3862883c
Author: Gary E. Miller <[email protected]>
Date:   Thu Oct 30 17:23:49 2025 -0700

    gpsd/gpsd.c: Add cast to remove 32-bit cc warning.

diff --git a/gpsd/gpsd.c b/gpsd/gpsd.c
index 1b302e22c..3de43edcb 100644
--- a/gpsd/gpsd.c
+++ b/gpsd/gpsd.c
@@ -1810,10 +1810,10 @@ static void all_reports(struct gps_device_t *device, 
gps_mask_t changed)
                                      device->lexer.outbuflen);
                     if (0 < ret) {
                         GPSD_LOG(LOG_IO, &context.errout,
-                                 "<= DGPS/NTRIP: %zd bytes of RTCM relayed "
-                                 "to fd %ld.\n",
+                                 "<= DGPS/NTRIP: %zd bytes of "
+                                 "RTCM relayed to fd %ld.\n",
                                  device->lexer.outbuflen,
-                                 dp->gpsdata.gps_fd);
+                                 (long)dp->gpsdata.gps_fd);
                     } else if (0 == ret) {
                         // nothing written, probably read_only
                     } else {


Reply via email to